Calculated property and spaces in DeckName


Another little question I can’t find the answer to:
Ive got an at-start-stack with a piece to show a count
Text label has $HowManyCards$ and in a calculated property HowManyCards I use $Big Piece_numPieces$ (name of the deck is Big Piece) This gives a red X and I tried to surround Big Piece with ’ ( { [ $ and < but it doesn’t work. How to use a DeckName with a space in it?


I don’t think having a space would make a difference …although I don’t know this for sure. Someone else will probably enlighten us on that point. Here’s a couple other things to consider.

Is the At-Start Stack on the same map as the Deck?

If they are on the same map, why not use $Big Piece_numPieces$ directly on the Text Label instead of creating a $HowManyCards$ variable first?


I narrowed my problem down to the space, I think.
I actually need $_numPieces$-1 that’s why the property

Spaces in property names are problematic. In Vassal 3.1, you only ever reference them using the $xxx$ syntax, which copes with spaces in property names, but you have no calculation capability. Vassal 3.2 still supports the $xxx$, but to do what you want, you will need to:

  1. Use Vassal 3.2, you cannot do this in Vassal 3.1

  2. Your HowManyCards Calculated Property should look like
    {GetProperty(“Big Piece_numPieces”) + 1}

If you get rid of the space in the Deck name, you could just use

  1. In your text label, which only supports $xxx$ syntax (no Calculator icon), use $HowManyCards$



It Doesn’t work, I get

Bad Data in Module: Expression evaluation error -Calculated Property[HowManyCards]={GetProperty(“Big Piece_numPieces”) + 1}, Error=Method Invocation _interp.getProperty

The outer { } always ‘disappear’, I tried differnet 3.2 builds for the sake of it & it doesn’t work for a deckname without spaces either

Ok, This is actually caused by bug 4685 which I just fixed the other day, but has not been merged into the trunk yet. Should be available soon.

This is working on my test version of Vassal with the bug fix included, however, it is still generating a spurious error message when you edit the piece, which I am looking into.

Yes, that is to be expected in a Calculated Property. The {} are used in the Calculator Icon fields that accept $xxx$ variables to indicate that you are actually entering a Beanshell expression. A Calculated property only allows a Beanshell expression, so the editor strips off any excess {} and adds them back in ‘behind the scenes’.

I have submitted a further bug fix to svn 8271 that should resolve the problem of error message being generated when loading or editing a module trying to access Global Variables that do not exist yet. e.g. Deck counts that only exists while a game is active.

Instead of generating an error, trying to access a Global variable that does not exist will just return a “”.


this problem is solved with svn 8299.

Thank you very much