LOOP

Syntax: #LOO range command

Execute the command a number of times given by the range. The range consists of a minimum numeric value, followed by a maximum value, separated by a comma. If only the minimum value is given, then a loop of 1,value is assumed (executing the command the number of times stated by the value). The current value of the loop variable is stored into the %i variable for use in the command.

You can also perform reverse loops by making the start value of the range larger than the finish value.

LOOP example

#LOO 3 north

sends the command north to the MUD three times

 

#LOO 1,4 {get coins %{i}.corpse}

sends the commands get coins 1.corpse, get coins 2.corpse, get coins 3.corpse, get coins 4.corpse to the MUD. Note that the {} braces are required around the i character. If you just used %i.corpse, then zMUD would think you were referring to the "corpse" field in the "i" database record.

 

#LOO @num {eat bread}

sends the eat bread command to the MUD the number of times contained in the @num variable.

 

#LOOP 5,1 {#SHOW %i}

displays 5 4 3 2 1

 

#LOOP -3 {#SHOW %i}

displays -1 -2 -3



Contents #LOOK #LOOPDB