Dice roll on card draw

Feeling stupid that I can’t get this to work…

How do I trigger an automatic dice roll when a card is drawn from a deck?

Thanks!

Make sure the map the card is going to has a trigger.

In map properties, apply a command to “Key command to apply to all units ending movement on this map”. Include something like CardRoll

On the cards, include a Trigger Action trait that will trigger on CardRoll and have it execute a command like RollTheDice.

Also include a Global Hotkey to trigger on RollTheDice and have it trigger the command you use to roll that dice.

Make sure the dice component has “Report Totals” checked.

Mwuhahahah. I now have all the tools I need to take over the world.

Muchas Gracias, Dr. Nostromo!

One more question:

I want to have a game piece access a dynamic property of another piece based on the fact that they share the same board.

For example Piece A has a score of 5 (dynamic property). Piece B is placed on the same board and therefore also has a score of 5. If Piece A’s score changes so does B’s. If B moves to a different board it no longer has the score that was dictated by A.

Am I making sense?

There is no way a piece could refer to other piece attributes/values/traits. You would need to use a Global Property instead through which you would pass the score to piece B. And the score should be calculated using somewhat vague and undocumented feature called Calculated Property.

Thank you Grouchysmurf. That is the way I’m going but I seem to be stuck in syntax in the calculated property.
I’ve named 4 boards “board1”, “board2”, etc.
I’ve created global properties named “board1shield”, etc.
I’ve set those global properties successfully with a card using the SET GLOBAL PROPERTY function using the name: $CurrentBoard$shield

Why doesn’t $CurrentBoard$shield work for the Calculated property? What syntax can I use to effectively do something like: $CurrentBoard$shield ?

I’ve spent many hours trying to get around this without success. Help would be appreciated.

After many hours of pulling my hair out…I finally figured a work around using a calculated property and nested “IF” statements.

There should be a more straightforward way, however.

Try {$CurrentBoard$+“shield”} – curly braces tell Vassal to perform “calculation”/“evaluation” of what’s inside them. $CurrentBoard$shield may be to tricky for Vassal internal logic.

My, so far, most fancy expression used in Calculated Property trait is “GetProperty(GetProperty(“name”))” – indirect addressing, beat this!

You should not mix $…$ constructs with {}.

The correct Beanshell expression is {CurrentBoard+“shield”} or {GetProperty(CurrentBoard)+“shield”}

Thank you. Will be giving this a try soon!