I have set up a dynamic property that gets assigned to individual counters. I want the value of the property to only show when the user executes a menu/keyboard command.
If I use the Text Label trait to show it (loading it in both the Text and Name Format fields), it is always visible. I tried adding menu and keyboard commands to the text label trait, but when I trigger the keyboard command it shows up as “Step Losses: $StepLoss4$”
Any suggestions would be welcome.
Thanks,
Jeff
You need another Dynamic Property which says whether the value is showing (this will be controlled by the menu/keyboard command you mentioned), and a Calculated Property which will contain the actual text:
Dynamic Property
-
Name: StepLossesShowing
-
Value: false
-
(Add Key Command)
[list]
[*]Menu Command: (put menu command text here)
-
Key Command: (put keystroke here)
-
Type: Set value directly
-
New Value: {(StepLossesShowing == true) ? false : true}
[/*:m][/list:u]
(Note: in theory you should be able to just use {!StepLossesShowing} for the New Value, but istr Vassal’s string-to-boolean type coercion is faulty with the ‘not’ operator so I suspect that wouldn’t work in practice.)
Calculated Property
- Property Name: StepLossesText
- Expression: (StepLossesShowing == true) ? ("Step Losses: " + StepLoss) : “”
In your text label trait, the text should be just $StepLossesText$.
That worked! Much Appreciated.