If
The If statement allows you to execute a statement or list of statements only if a given Condition is true.
Syntax
If statements begin with the if
keyword followed by a Condition, the then
keyword and a Statement or List of Statements.
Optionally, the Statement (or list of Statements) can be followed by the else
keyword and then another Statement (or list of Statements) which will be executed in the case the Condition provided is false.
note
When writing Statements as part of an If statement you do not need to end each statement with a ;
. Only one ;
is required at the end of the If.
Examples
Add a bonus to Piloting if it has more than one rank
if {character.piloting.ranks >= 1} then
bonus 2 to character.piloting as enhancement;
Add a bonus to attack based on the difference between Character Level and BAB
if {(character.level - character.bab) >= 3} then
[bonus 2 to character.attack.sniper as misc, bonus 2 to character.attack.smallArm as misc]
else
[bonus 1 to character.attack.sniper as misc, bonus 1 to character.attack.smallArm as misc];
Add ER against cold depending on Mystic level
if {character.mystic.level >= 20} then
bonus 30 to character.er.cold as enhancement
else if {character.mystic.level >= 16} then
bonus 20 to character.er.cold as enhancement
else if {character.mystic.level >= 6} then
bonus 10 to character.er.cold as enhancement;