[messages] Edit: Re: [Technical Support & Bugs] Bug 4308 Workaround?

irishwulf irishwulf at gmail.com
Mon Apr 9 05:27:42 MST 2012


[This message has been edited.]

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:
http://vassalengine.svn.sourceforge.net ... iew=markup[1]
The 'If' function begins on line 66, at least on revision 7868.

-Seth

[1] http://vassalengine.svn.sourceforge.net/viewvc/vassalengine/VASSAL-src/trunk/src/VASSAL/script/init_expression.bsh?view=markup


_______________________________________________
Read this topic online here:
http://www.vassalengine.org/forum/viewtopic.php?p=33074#p33074


More information about the messages mailing list