Skip to content

If

Warning

The If TLO is used to provide inline condition expressions for macros. It is not recommended for use with Lua.

Executes an inline condiition, similar to a ternary expression in other languages.

Forms

string If[conditions,whentrue,whenfalse]

Performs Math.Calc on conditions, gives whentrue if non-zero, gives whenfalse if zero.

Example

If I am sitting, stand up. Otherwise, echo "I am not sitting down"

/docommand ${If[${Me.Sitting},/stand,/echo I am not sitting down]}
string If[conditions~whentrue~whenfalse]

Alternate syntax, behaves the same as above but uses the ~ character as a separator instead of a comma.