Syntax: #LOO range {commands}

Execute the commands 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 a single 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 commands.

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 server 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 server. Note that the {} braces are required around the i character. If you just used %i.corpse, then TeSSH 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 server 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

Add comment

Login or register to post comments