Home mm2k6 Help Files Commands Script Flow Control - Loop
24 | 01 | 2018
Script Flow Control - Loop
Article Index
Script Flow Control
While
IF command
Loop
All Pages

Loop

Format: /loop {start,end} {commands}

Loop increments or decrements a number from start to end. Each time the number
is incremented or decremented the commands are executed. The loop number is
placed in the system variable $LoopCount.

  • {start,end} The start and ending numbers for the loop. If start is bigger than end, the loop will count backwards.
  • {commands} The commands to execute for each count of the loop.

/loop {1,3} {examine $LoopCount.corpse}
This would send the text "examine 1.corpse" "examine 2.corpse" and "examine 3.corpse" to the mud.

/loop {3,1} {look $LoopCount.man}
This does exactly the opposite. The number is decremented rather than
incremented and would send the text: "look 3.man" "look 2.man" "look 1.man"