How does Calculated Property work?

Hi.

I am wanting to add up the total cards discarded between two decks named “AxisDiscard” and “AlliedDiscard”.

Both discard decks have the “Perform counting of property expressions?” box checked.

I created a Text Label box on the same map as the decks and in the “Text:” field I entered this expression:
Total discards = $AlliedDiscard_numPieces$+$AxisDiscard_numPieces$

But that comes out in this format: Total discards = 3+2

I saw a “Calculated Property” Trait. When I opened it, I was hoping to find a “Help” button, but there is not one. I took a swag and filled in the “Property Name:” field as “TotalDiscards”

And in the “Expression:” field as $AlliedDiscard_numPieces$+$AxisDiscard_numPieces$

I went back to to the Text Label’s Text field and entered this expression:
Total discards = $TotalDiscards$

But now it says: Total discards =

And nothing.

I’m guessing I have a format error? I went to the Vassal Designer Guide, but Calculated Expressions is not listed, or if it is, it did not show up on a search of “calc”

Am I barking up the wrong tree or is there a better way to do this?

Thanks.

Then I went back to the textbox and told it

Got it.

I found a clue in another thread.

You take out the $ signs from all decks and enclose the equation is {}

Not sure why – but it worked.

Using $ in front of and after a variable is fine when simply using the variable by itself. This is built into Vassal and, up till recently, it was the only thing we could do with them.

In the past couple versions of Vassal, beanshell has been incorporated into Vassal. The { } is basically a way of telling beanshell to calculate something.

That’s what the difference is.