Fixed Loop
Fixed Loop¶
Repeats a set of commands a fixed number of times, iterating from a start value to an end value with a configurable step increment.
Properties¶
System¶
| Name | Explanation | Type |
|---|---|---|
| Commands | The commands to execute on each iteration of the loop. | Script |
| End | The ending value of the loop. The loop iterates until this value is reached. | Variable or Value |
| Increment | The step value added to the iterator on each loop iteration. Use a negative value to count downward. | Variable or Value |
| Is Inclusive | Whether the loop includes the end value. When enabled, the loop iterates up to and including the end value. When disabled, the loop stops one step before the end value. | Toggle |
| Iterator | The variable that stores the current loop index on each iteration. Only used when Use Iterator is enabled. | Variable or Value |
| Start | The starting value of the loop. The loop begins iterating from this value. | Variable or Value |
| Use Iterator | Whether to store the current loop index in a variable on each iteration. When enabled, the Iterator variable is updated with the current loop value. | Toggle |
Examples¶
Loop from 0 to 5 Inclusive¶
This repeats the contained commands 6 times, iterating from 0 to 5 inclusive without an iterator variable.
{"Data":{"Commands":[{"$":"WaitCommand","Duration":{"IsGlobalVariable":false,"IsLocalVariable":false,"IsValue":true,"Value":"100","VariableIndex":0,"Metadata":null},"IsBlockingInput":false,"Metadata":null}],"End":{"IsGlobalVariable":false,"IsLocalVariable":false,"IsValue":true,"Value":"5","VariableIndex":0,"Metadata":null},"Increment":{"IsGlobalVariable":false,"IsLocalVariable":false,"IsValue":true,"Value":"1","VariableIndex":0,"Metadata":null},"IsInclusive":true,"Iterator":{"IsGlobalVariable":true,"IsLocalVariable":false,"IsValue":false,"Value":"","VariableIndex":0,"Metadata":null},"Start":{"IsGlobalVariable":false,"IsLocalVariable":false,"IsValue":true,"Value":"0","VariableIndex":0,"Metadata":null},"UseIterator":false,"Metadata":null},"TypeName":"MAR.Game.Shared.Models.Scripts.Commands.Flow.ForLoopCommand"}
Loop from 0 to 10 Exclusive with Iterator and Step of 2¶
This iterates from 0 to 10 exclusive, stepping by 2, and stores the current loop index in Global Variable 0.
{"Data":{"Commands":[{"$":"WaitCommand","Duration":{"IsGlobalVariable":false,"IsLocalVariable":false,"IsValue":true,"Value":"100","VariableIndex":0,"Metadata":null},"IsBlockingInput":false,"Metadata":null}],"End":{"IsGlobalVariable":false,"IsLocalVariable":false,"IsValue":true,"Value":"10","VariableIndex":0,"Metadata":null},"Increment":{"IsGlobalVariable":false,"IsLocalVariable":false,"IsValue":true,"Value":"2","VariableIndex":0,"Metadata":null},"IsInclusive":false,"Iterator":{"IsGlobalVariable":true,"IsLocalVariable":false,"IsValue":false,"Value":"","VariableIndex":0,"Metadata":null},"Start":{"IsGlobalVariable":false,"IsLocalVariable":false,"IsValue":true,"Value":"0","VariableIndex":0,"Metadata":null},"UseIterator":true,"Metadata":null},"TypeName":"MAR.Game.Shared.Models.Scripts.Commands.Flow.ForLoopCommand"}
Loop with Local Variable Iterator¶
This iterates from 1 to 3 inclusive, storing the current loop index in Local Variable 0.
{"Data":{"Commands":[{"$":"WaitCommand","Duration":{"IsGlobalVariable":false,"IsLocalVariable":false,"IsValue":true,"Value":"500","VariableIndex":0,"Metadata":null},"IsBlockingInput":false,"Metadata":null}],"End":{"IsGlobalVariable":false,"IsLocalVariable":false,"IsValue":true,"Value":"3","VariableIndex":0,"Metadata":null},"Increment":{"IsGlobalVariable":false,"IsLocalVariable":false,"IsValue":true,"Value":"1","VariableIndex":0,"Metadata":null},"IsInclusive":true,"Iterator":{"IsGlobalVariable":false,"IsLocalVariable":true,"IsValue":false,"Value":"","VariableIndex":0,"Metadata":null},"Start":{"IsGlobalVariable":false,"IsLocalVariable":false,"IsValue":true,"Value":"1","VariableIndex":0,"Metadata":null},"UseIterator":true,"Metadata":null},"TypeName":"MAR.Game.Shared.Models.Scripts.Commands.Flow.ForLoopCommand"}