Property Match Expressions

# VASSAL Reference Manual Home > Property Match Expressions
## Property Match Expressions A Property Match Expression is a special type of Expression that is used to select a set of counters to be operated on (Module, Map, Deck or Counter Global Key Commands) or to test if some condition is true before taking action (Trigger Action, Restrict Commands). Just as there are two type of Expressions, there are two types of Property Match Expressions. BeanShell Expressions are identified by being surrounded by curly braces {}. They are very powerful and can be arbitrarily complex. Old-Style Expressions are identified by not being surrounded by the curly braces {}. Simple Expressions are less powerful than BeanShell expressions and are supported to provide compatibility with earlier versions of Vassal. When Property Match Expressions are used in a Global Key Command trait attached to a piece, there is a special format that must be used to match properties in the target pieces against properties in the piece that is generating the command. Any Property name enclosed in $ signs (e.g. $nation$) will be evaluated against the calling piece and replaced before the property Match is performed against other pieces. BeanShell Property Match Expressions BeanShell Property Match Expressions use the same syntax as BeanShell Expressions. They use the full syntax and capabilities of the BeanShell language and can be arbitrarily complex.
        {MaxHeight < (CurrentHeight + Growth) && Age > $myAge$}
        {Nation == (If (unitType=="Infantry", unitNation, formationNation))}
Old-style Property Match Expressions Old-style Property Match Expressions are not surrounded by the curly braces and have a much restricted syntax compared to their BeanShell equivalent. The left-hand side of each comparison MUST be a property name. The right-hand side of each comparison MUST be a string NOT surrounded by quotes. The Equals operator is = not ==. Parentheses () may NOT be used to create more complex expressions. Operators and functions may NOT be used to create more complex expressions.

Properties