Hello all,
I am just getting back into working on a module I started over a year ago and am noticing sluggishness with some features I had previously developed. In particular, I’ve designed a few global command keys which trigger dynamic properties, picking up on modifiers from individual pieces in the game, rolling a die and implementing a result. What I’m not sure about is whether there is an easier way to automate some of these things or if automation inherently slows down the performance.
The way I have approached it is to create a Dynamic Property using a nested set of boolean if:then statements to reflect die results. Using a made-up example, if I wanted a CRT to roll a die and implement the results, I would create something along the lines of:
Global command key triggers the Dynamic Property Combat
Combat has the following expression:
{((CombatDieRoll<=1) ? (Exchange) : (((CombatDieRoll>1&&CombatDieRoll<=4) ? (AttackerRetreat) : (((CombatDieRoll==5) ? (DefenderRetreat) : (DefenderEliminated))))))}
CombatDieRoll would be a Calculated Property with the expression Random(6).
This would be used to represent:
Die
1 = Exchange
2 = Attacker Retreat
3 = Attacker Retreat
4 = Attacker Retreat
5 = Defender Retreat
6 = Defender Eliminated
An alternative way I’ve formulated something like this is through individual Trigger Actions associated to a global command key firing CombatDieRoll. In this case, I might have a prototype embedded in pieces with the following Trigger Actions:
ExchangeTrigger with a matching property {CombatDieRoll<=1}
AttackerRetreatTrigger with a matching property {CombatDieRoll>1&&CombatDieRoll<=4}
DefenderRetreatTrigger with a matching property {CombatDieRoll==5}
DefenderEliminatedTrigger with a matching property {CombatDieRoll>=6}
Are either of these approaches faster than the other, or alternatively, am I just going about this the wrong way and there is another trick which might work better? Or … is this too much to try to automate within VASSAL?
Thanks again for any insights.