If

From the Oblivion ConstructionSet Wiki
Revision as of 03:42, 26 March 2006 by imported>JOG (Added a reference list for complex expressions in IF-blocks)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Oblivion's "IF"-command is very powerful and comparable to "real" programming languages. The expressions to test on can be very complex:


Assuming, "a = 17", "b = 20" and "c = a - b", all of the following expressions work fine, and parentheses are only needed when they're necessary out of mathematical reasons:

IF c == -3 && b == 20

IF c == -3 && b == 20 && a == 17

IF c - 1 == -4 && b == 20 && a == 17

IF a - 20 == 17 - b

IF a - 20 == 17 - b && c + 3 == 0

IF a + 3 == b

IF a - b == c

IF a *4 - b * 4 == c * 4

If a * ( 5 + c ) - 14 == b


What doesn't work is using the && and || operators for bitwise comparsion:

IF a && 16


this will allways be true, as long as a != 0