Create account / Log in

Return to different decks

Talk about module design ideas and techniques.

Moderators: uckelman, Tim M

Return to different decks

Postby grouchysmurf » April 26th, 2014, 6:51 am

I've been working on module for Unhappy King Charles lately. It features somewhat convoluted card dealing procedure which I managed to implement and about which I wanted to brag as this is most fancy function I've ever implemented in VASSAL.

:-)

But to the point.

There is a map window with four decks - Discard Pile, A, B, C. When cards are dealt, players are dealt few cards from deck A and one player gets all the cards from deck B, while the other all the cards from deck C. When card is played, it may go to, either, Discard Pile or to deck B or to C. To where the card is discarded, depends on the card trait.

I tried to achieve that by adding multiple triggers with the same hot key but with different criteria -- but this does not work; it insteads greys out the item in the piece right-click menu if the criteria are not met.

Any hints?
User avatar
grouchysmurf
 
Posts: 178
Joined: August 9th, 2011, 7:48 pm

Re: Return to different decks

Postby grouchysmurf » April 26th, 2014, 7:40 am

And another question, only slightly related to my previous post: again, assume there is a deck A on a map M. Assume there is a zone Z on map M which happens to be located in the same place as the deck A.

Cards from deck A are dealt through the GKC, based on the DeckName property i.e. the action Send to Location (player hand) is triggered when the DeckName == "A". Now, if I send the card back to the zone Z (which overlays the deck A), does the card aquire the property DeckName == "A" or is it so that this property is acquired only through the Return to Deck function?
User avatar
grouchysmurf
 
Posts: 178
Joined: August 9th, 2011, 7:48 pm

Re: Return to different decks

Postby Sebaestschjin » April 26th, 2014, 10:01 am

Regarding your second question: When send to a location which is occupied by a deck the piece will be put into the deck. Which means it's on top of the deck, when the deck is not shuffled. So, yes the card will have the DeckName == "A" property as it is now in the deck.

Since you alreay have locations on the decks that's what I would use for your first question. Instead of using the "Return to Deck" trait, use the "Send to location" trait and send the card to the location of the deck it belongs to.
Sebaestschjin
 
Posts: 23
Joined: April 10th, 2014, 10:49 am

Re: Return to different decks

Postby dsdhornet » April 26th, 2014, 3:10 pm

For your first question, multiple triggers with conditions will work, and probably do if you use a keyboard shortcut (which will attempt to trigger both menu options) as opposed to selecting the option from the menu. However, if you want only one menu option, I've found that the following method works best.

1. For each of the two triggers (with conditions), leave the "Menu Command" blank. This means that the trigger will not appear in the right-click menu. Set the "Keystroke" on each to be the same. I'd use something like "trSendToDeck" (note, you aren't limited to single key commands with modifiers, and using something totally unique can reduces the chance of accidental triggering as well as make triggers easier to remember).
2. Add a 3rd "trigger action" with the menu command that you want shown in your right-click menu, and whatever shortcut you want to use. This command will appear in the menu. Leave the "condition" blank. Under "Perform these keystrokes", type in "trSendToDeck" or whatever you used in step 1.

Basically, when you select the option from the menu (or hit the shortcut), it calls the parent trigger (set up in step 2), which then triggers the child commands (conditionally). The parent trigger is needed to combine all child triggers into one menu option.

Note that you may have to be a little careful if final actions can change the conditions. For example, if you have an action that changes ValueA to 1 if it is 0 and changes ValueA to 0 if it is 1 (while something else changes it to 2, hence not using a wrapping variable), you have to be creative. If ValueA is 0 and triggers the first action first (changing ValueA to 1), it now meets the criteria of the second action (which changes it back to 0). Hilarity ensues. I wish they would create a "Conditonal trigger" that would trigger trA if value is 'A', trigger trB if value is 'B', etc.

Also note, this method (with the parent trigger) can be used with all sorts of things. For example, a conditional delete option: Delete command has no menu option and trigger such as "trDelete", while Trigger Action command has menu command "Delete", keyboard command CTRL-D, and triggers "trDelete" if a condition is met..."Delete" option in menu will be greyed out if condition is not met.
dsdhornet
 
Posts: 12
Joined: April 26th, 2014, 5:52 am

Re: Return to different decks

Postby grouchysmurf » April 26th, 2014, 5:30 pm

dsdhornet wrote:Basically, when you select the option from the menu (or hit the shortcut), it calls the parent trigger (set up in step 2), which then triggers the child commands (conditionally). The parent trigger is needed to combine all child triggers into one menu option.


That's uber-cool! Very elegant yet effective, thanks.

@Sebaestschjin - thanks for clarifying the deck vs. location issue.
User avatar
grouchysmurf
 
Posts: 178
Joined: August 9th, 2011, 7:48 pm


Return to Module Design

Who is online

Users browsing this forum: No registered users and 5 guests