ProtoFlux:If: Difference between revisions

From Resonite Wiki
add if node
 
Added a suggestion. Updated description.
 
(4 intermediate revisions by 2 users not shown)
Line 4: Line 4:
|Inputs=
|Inputs=
[
[
{"Name": "*", "Type": "Impulse"},
{"Name": "*", "Type": "Call"},
{"Name": "Condition", "Type": "bool"}
{"Name": "Condition", "Type": "bool"}
]
]
|Outputs=
|Outputs=
[
[
{"Name": "OnTrue", "Type":"Impulse"},
{"Name": "OnTrue", "Type":"Continuation"},
{"Name": "OnFalse", "Type":"Impulse"}
{"Name": "OnFalse", "Type":"Continuation"}
]
]
|}}
|}}
The '''If''' node checks and evaluates the Condition ([[Type:Bool|bool]]) only when * ([[Impulses|Call]]) is called. After the call and evaluation, it will send a pulse out of OnTrue ([[Impulses|Continuation]]) if Condition ([[Type:Bool|bool]]) is <code>true</code> or OnFalse ([[Impulses|Continuation]]) if it is <code>false</code>.
{{Note|If you want something similar to this but with data, [[Value Type|values]], or [[Reference Type|references]], use the [[ProtoFlux:Conditional|Conditional]] node instead.|suggestion}}
== Inputs ==
=== * ([[Impulses|Call]]) ===
Triggers this node to check Condition ([[Type:Bool|bool]]) and send an impulse down OnTrue ([[Impulses|Continuation]]) or OnFalse ([[Impulses|Continuation]]) respectively.
=== Condition ([[Type:Bool|bool]]) ===
A boolean to check only when * ([[Impulses|Call]]) is impulsed.
== Outputs ==
=== OnTrue ([[Impulses|Continuation]]) ===
Sends an impulse when * ([[Impulses|Call]]) is impulsed and Condition ([[Type:Bool|bool]]) is true.
=== OnFalse ([[Impulses|Continuation]]) ===
Sends an impulse when * ([[Impulses|Call]]) is impulsed and Condition ([[Type:Bool|bool]]) is false.
== Examples ==
<gallery widths=480px heights=480px>
File:Protoflux_example_if_node.webp|an if node being used to filter the flow of an impulse chain.
</gallery>


[[Category:ProtoFlux:Flow]]
[[Category:ProtoFlux:Flow]]

Latest revision as of 10:15, 27 June 2024

If
*
OnTrue
Condition
OnFalse
Flow

The If node checks and evaluates the Condition (bool) only when * (Call) is called. After the call and evaluation, it will send a pulse out of OnTrue (Continuation) if Condition (bool) is true or OnFalse (Continuation) if it is false.

If you want something similar to this but with data, values, or references, use the Conditional node instead.

Inputs

* (Call)

Triggers this node to check Condition (bool) and send an impulse down OnTrue (Continuation) or OnFalse (Continuation) respectively.

Condition (bool)

A boolean to check only when * (Call) is impulsed.

Outputs

OnTrue (Continuation)

Sends an impulse when * (Call) is impulsed and Condition (bool) is true.

OnFalse (Continuation)

Sends an impulse when * (Call) is impulsed and Condition (bool) is false.

Examples