[messages] [Module Design] Displaying Dynamic Property Value via Keyboard Command

Foobarius alter.alter.ego at hotmail.com
Thu Oct 22 00:52:49 CEST 2015


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)

     * Menu Command: (put menu command text here)
     * Key Command: (put keystroke here)
     * Type: Set value directly
     * New Value: {(StepLossesShowing == true) ? false : true}





(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$.

_______________________________________________
Read this topic online here:
http://www.vassalengine.org/forum/viewtopic.php?p=50104#p50104


More information about the messages mailing list