Bug? Change Property-Toolbar Button report format

Vassal version: 3.4.8

The report format in the Change Property Toolbar Button trait will, like other Report formats, accept a Beanshell expression in {}. In general this works fine.

However, properties within that beanshell expression that contain boolean values seem to be processed as null values, regardless of their actual content. This is the case for the actual property that is being Changed and for the associated properties “oldValue” and “newValue”. Other properties, such as PlayerId are returning their correct values.

Example:-

{ gp == true ? “True” : “False”}

will always report “False” though the value expression is specified to toggle the value of “gp”; for example": {gp != true}

  • and when use of "gp’ - e.g. to set a Layer - confirms that gp is indeed being toggled.

The same is seen if “oldValue” or “newValue” are used in the report expression. However, if a standard report expression is used ie no {Beanshell} - the values of all 3 properties are shown correctly when surrounded by $…$ .

Hi Mark,

The fact that Beanshell expressions work at all in Report Formats is completely by chance and not by design. The mixing of $$ values and Beanshell just won’t work at all for now. $oldValue$ and $newValue$ are not real properties and only exist in the conext of the report format, Beanshell doesn’t know about them.

Since Beanshell already (sort of) works, I will look into the possibility of allowing Beanshell in Report Formats to access the $$ variables that are available within that Report Format. (vassalengine.org/tracker/sho … i?id=13606)

btw, I set up a Global Property exactly as you described, but I could not reproduce your issue with the Beanshell not reporting the Global property value. {gp == true ? “True” : “False”} reported correctly as True or False as I clicked the Change button.

[attachment=0]gp.png[/attachment]

Hi Brent,

Thanks for raising that ticket… I guessed that it was lucky that report formats worked at all, and generally it has not been an issue for me that $$ values don’t work inside the Beanshell expression.

I will look some more into my example; interested to see if it will work for me in a stand-alone demo.

Mark