v3.5.5: Mouse-Over Sum() doesn't work

The documented Sum() feature is throwing an Expression evaluation error, even for the simplest expressions.

Example: - Bad Data in Module: Expression evaluation error {Sum(“IgnoreFLG”)}

IgnoreFLG does exist on the test piece (though that shouldn’t matter).
Rest of Mouse-Over text was displaying as expected.

Workaround: I will try using piece-based methods in the “below text”.


In one of my modules, each unit has a Dynamic Property named strength

In the mouse-over stack viewer component I have:

Text below each piece


Summary text above pieces

$LocationName$: $sum(strength)$

Has worked in vassal 3.2.17 through 3.5.5

Thank you Robert. That’s made me look again… it won’t have helped that I capitalised “Sum”. Beyond that, I am starting to suspect that the special mouse-over functions, sum() and perhaps $countPieces$, just aren’t Beanshell-friendly.

From the manual, as my link as never going to work either:
“Summary text above pieces: A Message Format specifying the text to display above the drawn pieces in the viewer. In addition to standard Properties, you can include $countPieces$ to count the pieces included in the display. You can also include a property with the name sum(propertyName) where propertyName is a property defined on a Game Piece. The sum of the numeric values of this property for all included pieces will be substituted.”

Yes, that is it. sum() only works outside of Beanshell and must be enclosed in $…$, like some of the special Report trait properties. Also, the property name must not be enclosed in quotes. A relic of earlier versions of Vassal, I guess.

I’m glad there’s a working method to do it, but we should probably fix the beanshell version too, if you wanted to open a bug for that.


Done: vassalengine.org/tracker/sho … i?id=14465