ProtoFlux:While: Difference between revisions

From Resonite Wiki
added examples, no longer a stub
m fix types
Line 4: Line 4:
|Inputs=
|Inputs=
[
[
{"Name": "*", "Type": "Impulse"},
{"Name": "*", "Type": "Call"},
{"Name": "Condition", "Type": "bool"}
{"Name": "Condition", "Type": "bool"}
]
]
|Outputs=
|Outputs=
[
[
{"Name": "LoopStart", "Type":"Impulse"},
{"Name": "LoopStart", "Type":"Call"},
{"Name": "LoopIteration", "Type":"Impulse"},
{"Name": "LoopIteration", "Type":"Call"},
{"Name": "LoopEnd", "Type":"Continuation"}
{"Name": "LoopEnd", "Type":"Continuation"}
]
]

Revision as of 21:28, 9 February 2024

While
*
LoopStart
Condition
LoopIteration
LoopEnd
Flow

A While node will start running when * is impulsed. The code will continue running and hold a context until the provided Condition is false or the max execution iterations is hit.

If just a Input with the type boolean set to true is provided, the code will not be able to stop and will error the entire Flux chain once max iterations is it, stopping execution.

Caution should be exercised when using this node. If it is easy to determine how often the loop is going to execute, a For-Loop should be preferred to avoid accidentally crashing the game.

Inputs

* (Call)

Impulse to start the loop

Condition (Boolean)

The value that the loop will check for if it should continue running or not.

Outputs

LoopStart (Impulse)

Fires once at the beginning of the loop, regardless of if Condition (Boolean) is true or not.

LoopIteration (Impulse)

Fires infinitely all in one game tick until the game crashes, or Condition (Boolean) is false. Will only fire if Condition (Boolean) is true.

LoopEnd (Impulse)

Fires once the triggered loop has ended and the node has not hit a critical error.

Examples