Is there a way to do something like the following (for example in a Trigger property check):
Type = Infantry && (Status = dead || Defense < 3)
At the moment (Vassal 3.1.18) it doesn’t seem to work, at least with that syntax. Regular expressions won’t help, either, I think.
I can get around this problem by splitting it in two different triggers, or using a trigger and a combination of restrict commands etc… but it seems a waste of keystrokes and/or traits.
Is the order of operations published somewhere? Honestly, I have been splitting complex expressions into multiple triggers to be sure the order is explicit, but it would be handy to know how the expressions are actually evaluated.
I was able to verify in my own module that, indeed, we are not limited to a single logical comparison operator. However, I didn’t test precedence. For the time being I assume everything is left-to-right, as if there are implicit parentheses like these:
A quick look at the PropertiesPieceFilter class indicates that the way this is done in 3.1.18 is:
(1) Split the expression around ||
(2) Split each subexpression around &&
(3) Try to match each subexpression to an OPERAND COMPARATOR OPERAND pattern - succeed (!!) if unable to match this pattern (so, i.e., setting ‘MyProp’ to ‘false’, and entering ‘MyProp’ as the property match expression, will always succeed. For that matter, ‘false’ will always succeed)
This order, with OR operands at the highest level, is borne out in my own brief testing; so, for instance, the following will evaluate to true with MyProp = TRUE:
MyProp = FALSE && MyProp = FALSE || MyProp = TRUE
Therefore, basically you are saying that the answer to my question above is YES.
I can confirm I have noticed this is how things appear to be working, after the original reply by Tim M.