For
for runs the line or block after it once for each value of variable, counting from start to end.
It counts up when start is smaller than end and down when it is larger.
Parameters
Section titled “Parameters”| Parameter | Meaning |
|---|---|
variable |
The counter. Any variable works, including system variables such as #FindIndex. |
start |
First value, a whole number. |
end |
Last value, a whole number. It is read once, when the loop starts: changing it inside the loop has no effect. |
A block is a { line, the lines to run, and a matching } line. The { has to be the very next line:
a blank line or a comment in between means only that line belongs to the command, and the block after it
runs every time. Braces go on lines of their own. Without a block, only the next line is repeated.
Leave a loop early with break, or skip to the next value with
continue.
Examples
Section titled “Examples”for %i 1 20{ event sysmessage %i wait 10}haltCounting down, and using a system variable as the counter:
for %i 10 1 event sysmessage %i
finditem POF C_ , #BackpackIDfor #FindIndex 1 #FindCnt event sysmessage #FindID holds #FindStack goldhaltSee also
Based on the EasyUO wiki, edited for EasyUO Reforged. This text is available under the GNU Free Documentation License 1.2.