Simple IF statement

A simple IF statement function would be nice that could be used in a global processing area. So you can do simple changes to any item.

For example, I have a piece that I want to check a global variable to determine what layer to show.

I know there are probably long ways to accomplish this. But almost everything must rely on a keystroke. I just think a simple IF statement function would help do a lot of things more simply.

Thus spake wootersl:

A simple IF statement function would be nice that could be used in a
global processing area. So you can do simple changes to any item.

For example, I have a piece that I want to check a global variable to
determine what layer to show.

I know there are probably long ways to accomplish this. But almost
everything must rely on a keystroke. I just think a simple IF statement
function would help do a lot of things more simply.

This will be possible with scripting in V4.


J.

Perhaps I’m not sure exactly what you want to do, but in 3.1 conditional logic is handled with Trigger Action:
Set label to ‘Destroyed’ if HP < 6:

  1. Fire <check_hp_keystroke>
  2. On <check_hp_keystroke>, Trigger Action with matching properties: CurrentHP < 6
  3. For that Trigger Action, in ‘Perform these keystrokes’, fire <update_label_keystroke>

In 3.2, there is an ‘If’ callback for BeanShell expressions. So you could set your label as something like:
{ If(CurrentHP < 6, “Destroyed”, “”) }
At least that is how I remember the syntax. How often is CurrentHP automatically checked for this text label? I don’t remember! Possibly just once, when you first create the piece! You will probably still have to nudge it every time you change the CurrentHP. Not many things in Vassal 3 are very good at actively listening for changes.

-Seth