Documentation

if

Syntax: %if(expression,true-value,false-value)

if expression is true, return the true-value otherwise return the false-value.

Examples:

#ALIAS ccc {cast %if("%1"="darker",sanct,fireball) %1}

ccc ork
casts a fireball at any target, except if it's called 'darker', in which case it casts sanct.
#LOOP 20 {#SHOWPROMPT %ansi(%if(%i\2=0,green,"blue,bold")).oOo};#SHOW
displays the string '.oOo' in green and light blue, alternately. The %i\2 is the same as %mod(%i,2). The #SHOW is needed at the end to display the newline character after the string.
#LOOP 40 {%if(%i<=20,n,s)%if((%i>15) AND (%i<=30),w,o)}
sends 15 times 'no', then 5 'nw', then 10 'sw', then 10 'so' to the mud.

Add comment

Login or register to post comments