I would like to add a PV calculator for the players. Each mech counter has a PV value. I would like Vassal to compute the total PV value every time he pulls a mech counter from the menu and places it on the board. Same goes when he deletes a mech counter from the board. But I have no idea what trigger mechanism to use. I hope someone will point me to the right direction. Thanks.
To detect when a mech counter is newly placed onto the board, you can modify the board’s Map Window trait to define a Key Command (e.g. - MovedOnMap) which will be sent to any game piece which ends its movement on that map board. See the Key command to apply to all units ending movement on this map field of the Map Window trait. This will cause the MovedOnMap command to be sent to all pieces which end their movement on the map.
Next add a Trigger Action trait to the mech counter pieces (only) to:
- Listen for that command (Key Command = MovedOnMap),
- Verify that the movement did not originate already on that map (Trigger when properties match = {CurrentMap != OldMap}), and
- Send a command for the purpose of increasing the PV value (Perform these Key Commands = IncrementPV)
Then add a Set Global Property trait for the mech counters which will listen for that IncrementPV command and increase the Global Property where (I assume) you maintain the PV value.
Decreasing the PV value when a mech counter is “deleted” depends on how that deletion occurs.
If the counter is literally deleted (via a Key Command which activates the counter’s Delete trait), then the Key Command which causes the deletion can also be used in the previously described Set Global Property trait to decrease the PV Value. Note however that you may need to define the Set Global Property trait to appear after the Delete trait, so that it executes prior to deletion of the game piece.
If the mech counter can be “deleted” by moving it to a different board (e.g. - for eliminated units), then you should use the technique described earlier to detect movement ending on that board also. Assuming the same MovedOnMap command is defined for both boards, then you need to define two different Trigger Action traits which listen for that command - one to control when the IncrementPV command is sent and one to control when the DecrementPV command is sent. The Property Match expressions for those two triggers would need to be customized so that each Trigger fires only when movement ends on its corresponding map.
For example, to detect when a mech counter is moved from the “MainMap” board to the “EliminatedUnits” board, the Property Match expression which sends the DecrementPV command could be set to
{(OldMap == “MainMap”) && (CurrentMap == “EliminatedUnits”)}
These instructions are somewhat vague on details, but will hopefully point you in a good direction. Feel free to ask follow up questions.
Cheers,
Jim Hunter.