IF
Syntax: #IF (expression) {true-command} {false-command}
Allows conditional execution. If the expression is true, then the true-command is executed. If the expression is false, then the false-command (which is optional) is executed. Expressions can contain variables and operators.
IF examples
#IF (@autosplit) {split @gold}
If the @autosplit variable is non-zero, then the value of @gold is expanded, the string split is sent to the MUD followed by the value of @gold.
#IF (@gold < 100000) {emote is poor} {emote is RICH!}
If the value of the @gold variable is less than 100000, then the string emote is poor is sent to the MUD, otherwise the string emote is RICH! is sent to the MUD.
#IF (@line =~ "You receive (%d) coins") {split %pat(1)}
If the value of the variable @line matches the pattern You receive %d coins, then the number of coins matched is stored in the %pat(1) function, and the string split is sent to the MUD, followed by the matched pattern. |