Usage:

if (this condition is met) do this stuff

Example:

if (city.troop.archer < 20k) train a:5k BigDude

Just like the IfGoto and IfGosub commands, this will check if some condition is met first. Unlike those scripts however, it doesn't need to jump to a label elsewhere to perform an action based on the condition, it can instead perform it right there on the line. This allows you much more power and flexibility to create your scripts.

In the example above, if the city has less than 20k archers, then it will train 5k archers with the hero BigDude and carry on to the next line (if one exists).

If can also use goto/gosub jumps to labels in it, for example:

While we do not yet support && and || operations in Ifs, you can check for more than one condition to be met with nested Ifs, for example:


ScriptControlStructures

If (last edited 2012-12-04 22:02:34 by Inanna)