CountStack(expr) issues

I tried to use CountStack(expr) to count the counters in a stack that have a given property (Type = FSA), but I obtained always a zero result. This is because I’m surely not using the correct syntax in the BeanShell, and I don’t know how to make this command working. I tried several espressions but none worked.

Please, someone can kindly explain which is the correct syntax to be used?

Thank you

I use $StackSize$ in a Text Label

I need to know the number of the counters in a given stack that have a given property, not the number of all the counters in the stack. I tried to insert an expression like “Type = FSA” in the CountStack(expr), but It doesn’t work, giving a 0 result everytime.

This syntax doesn’t work : CountStack(“Type==FSA”) like many others I tried.

I need to know which is the correct syntax. ( I hate Beanshell….).

Many Thanks

panther_2010

:joy:

Try this then:
Game Piece Prototype: “Name of Type Piece” Marker: Property name: Unit (This is the Property to Count) Property Value: 1
Mouse over Stack:-

Have you looked at the Sum and Count functions reference page? There’s an example of what you need to do–although I see that it’s flawed in that it’s missing a quote between the closing brace and closing right paren:

Because the parameter you’re passing to CountStack is itself a string, you need to escape the quote marks that denote the text string you want to match on the righthand side of your expression.

So:

CountStack("{Type==\"FSA\"}")

The Function Builder in VASSAL will construct it correctly: