SumStack function (version 3.4.11)

The SumStack function does not appear to be working at this point. When I attempt to SumStack with a Dynamic property name (I’m using a Marker property with a value of 2 on the unit), it returns a null value. I’ve set the Dynamic property to “is numeric” value with 0 as the starting value. When I select the counter and press the key combo to change the Dynamic property’s value to the SumStack’s value, it removes the 0 and replaces it with a null value. I’ve tries to load other values into the Dynamic property with no problem. Only with the SumStack function do I receive a null value into the numeric Dynamic property value. I’ve also tried a Dynamic property without checking the “is numeric” value check box, but still have the same problem - whatever value the Dynamic property starts with is replaced with a null value.

Could you post the actual text of your SumStack expression please.

Here is the value to set in the Dynamic Property xxxD:
for xxxA, SumStack(AAStr)
I’ve attached a picture to put this in context.

This is what appears in the Chat window once I press Alt-Ctrl-D to execute the SunStack(ADStr) function and the SunStack(AAStr) function.

  • Jim> Supplied (Attk: 0 – Def: 0) created in 1B/1920
  • Bad Data in Module: Supplied (Attk: 0 – Def: 0) [Dynamic Property - PatrolZoneOn] - Expression evaluation error {SumStack(ADStr)}
  • Bad Data in Module: Supplied (Attk: 0 – Def: ) [Dynamic Property - PatrolZoneOn] - Expression evaluation error {SumStack(AAStr)}

if you have a look in the reference manual, they use this example:


to sum the values of the property named Attack in all counters on the stack.

Your version


Is looking for a property named ADStr in the current counter, finding the value of that property (let’s say its 42) and then using that value as the name to look up the values in the rest of the Stack. So you are effectively calling


I think what you want is


Thank you for the clarification on use of SumStack function. It is a bit confusing when to put a property in quotes and when not too.
Thanks for your help! Jim.

I just figured out what happened with SumStack. I used the “Insert” feature and selected the Property from the list of properties. It didn’t add the quotes around the property and I assumed this was correct. If you have nothing else to do (LOL) you might take a look at modifying this entry result. Otherwise, no problem, I’ll just remember. :slight_smile:

The problem is that sometimes you want the property name quoted and sometimes you don’t. It is not possibly for Vassal to know which you want.

There are always exceptions to these rules of thumb, but in the Sum and Count functions, you will nearly always want the property names to be quoted and in general Beanshell expressions, you will generally want them not quoted.

Great! That will help me significantly during development of the module (or any module)! I’m going to print your suggestion for syntax and post it next to my monitor - this will help me apply proper syntax the first time with less confusion on my part! Thanks!