WME script supports if and if...else conditional statements. In if statements a condition is tested, and if the condition meets the test, the relevant block of code is executed. In the if...else statement, different code is executed if the condition fails the test.
The following comparison operators are accepted in the conditional statements:
== … equal
!= … non equal
< … less then
<= … less than or equal
> … greater than
>= … greater than or equal
The block of code in the conditional statement can be either a simple statement or a compound statement (multiple statements enclosed in the curly braces).
Examples:
if(Scene.Name=="MyScene") { actor.GoTo(100, 200); actor.TurnTo(DI_DOWN); } else { actor.GoTo(500, 200); actor.TurnTo(DI_UPDOWN); } |