Bug 4308 Workaround?

I’ve been working on a Vassal 3.2 version of my Space Empires 4x module and have really been enjoying the Calculate Property function.

However, regarding bug 4308 (vassalengine.org/tracker/sho … gi?id=4308) where the Expression Builder does not insert the functions into the text, is there a work around?

I could really use some IF/THEN statements, is there a way to type these manually? I’m not familiar enough with BeanShell to know how to do this.

Thanks in advance!

Absolutely, you can put them in manually. BeanShell supports Java syntax for if statements, but in most if not all places that you can enter BeanShell in Vassal, you are working with an expression, not a statement, so you would want the trinary ? : operators:
{ UnitStrength > 5 ? “Uninjured” : “Injured” }
The If function that Brent has written goes like this:
{ If(UnitStrength > 5, “Uninjured”, “Injured”) }
The second format is probably easier to read for most people. You can see the syntax of the callbacks that Brent has written here:
vassalengine.svn.sourceforge.net … iew=markup
The ‘If’ function begins on line 66, at least on revision 7868.

-Seth

Awesome, thanks. I was trying to type it manually earlier, but I did not have the capitalization correct. Great!