No such restriction exists. Your expressions can be arbitrarily complex with any number of operators and Property references.
It’s doesn’t handle non-integer arithmetic very well at the moment. It will return results with decimal places from divisions, but any attempt to use them as expression values will fail. This is basically the same as the original arithmetic, but it is not failing quite so gracefully. Even if an expression returns a floating point value, there is very little you can do with it in Vassal.
Is there a particular reason you want to do floating point arithmetic? Or are you just testing?
I should be able to extend the Expression interpreters to support floating point if you can convince me it will be useful.
Ok,
It turned out this was really easy to fix. Arithmetic now follows Java rules. If you divide one integer into another integer, you get an integer result. If either value is a float, you get a float result. To force a float result from fividing two integers, you need to cast one to a float value:-
{ property1 / (float) property2 }
Note you can use any elements of the Java language in expressions, plus utlity classes like Math.
Ok,
It turned out this was really easy to fix. Arithmetic now follows Java
rules. If you divide one integer into another integer, you get an
integer result. If either value is a float, you get a float result. To
force a float result from fividing two integers, you need to cast one to
a float value:-
{ property1 / (float) property2 }
Note you can use any elements of the Java language in expressions, plus
utlity classes like Math.
I am using floating point to calculate the distance a token is moved. Using a loop implementing Newton’s Method, one can get the square root of the (X^2 + Y^2). You say “Note you can use any elements of the Java language in expressions, plus utility classes like Math”, Does this mean Square Roots are now available?