VASSAL Reference Manual
Home > Module > Game Piece Palette > Game Piece > Calculated Property
Calculated Property
A Calculated Property defines a Property which has a value that is calculated by a formula each time it is needed. The property can be referred to by name in other traits in the piece, either for creating Message Formats to display messages or in e.g. Property Match Expressions. Each place the property name is referred to in an expression, the value will be recalculated and substituted.
Note
|
Unlike many fields in VASSAL, Calculated Properties exclusively support BeanShell Expressions. Thus "Old Style VASSAL" comparisons e.g. with single = sign, and the ~= operator, are not supported here. The traditional {..} marks around BeanShell expressions also do not appear in this context. |
VASSAL will recalculate the value of the Expression each and every time its value is asked for: whether it is referenced in another Calculated Property, an Expression or field in another type of trait, or is displayed in a message or a text field. This ensures the value will be kept accurately updated, though module designers should be aware that long complicated chains of Calculated Properties can therefore lead to "lag" and slower performance.
|
|