Conditional Loop
Conditional Loop¶
Repeats commands as long as all specified conditions continue to be met.
Properties¶
System¶
| Name | Explanation | Type |
|---|---|---|
| Commands | The commands to execute on each iteration of the loop while the conditions remain met. | Script |
| Conditions | The conditions that must all be met for the loop to continue iterating. The conditions are re-evaluated at the start of each iteration. | Condition |
Examples¶
Loop While Global Switch 0 is On¶
This repeats the contained commands as long as Global Switch 0 remains on.
{"Data":{"Commands":[{"$":"WaitCommand","Duration":{"IsGlobalVariable":false,"IsLocalVariable":false,"IsValue":true,"Value":"100","VariableIndex":0,"Metadata":null},"IsBlockingInput":false,"Metadata":null}],"Conditions":[{"$":"SwitchCondition","IsLocalSwitch":0,"SwitchComparison":0,"SwitchIndex":0,"Metadata":null}],"Metadata":null},"TypeName":"MAR.Game.Shared.Models.Scripts.Commands.Flow.WhileLoopCommand"}
Loop While Global Variable 0 is Less Than 100¶
This repeats the contained commands as long as Global Variable 0 is less than 100.
{"Data":{"Commands":[{"$":"VariableCommand","Operation":1,"RandomEnd":null,"RandomStart":null,"Value":"1","Index":0,"IndexEnd":null,"IsLocal":0,"IsOperandReference":0,"IsReference":0,"OperandGlobalIndex":null,"OperandLocalIndex":null,"Metadata":null}],"Conditions":[{"$":"VariableCondition","IsLocalVariable":0,"VariableIndex":0,"VariableComparison":2,"CompareToValue":{"IsGlobalVariable":false,"IsLocalVariable":false,"IsValue":true,"Value":"100","VariableIndex":0,"Metadata":null},"Metadata":null}],"Metadata":null},"TypeName":"MAR.Game.Shared.Models.Scripts.Commands.Flow.WhileLoopCommand"}