ProtoFlux:Indirect Decrement: Difference between revisions

From Resonite Wiki
m node visual wrong
m change impulse to call
(8 intermediate revisions by the same user not shown)
Line 4: Line 4:
|Inputs=
|Inputs=
[
[
{"Name":"*", "Type":"Impulse"},
{"Name":"*", "Type":"Call"},
{"Name":"Variable", "Type":"Variable"}
{"Name":"Variable", "Type":"IVariable`2"}
]
]
|Outputs=
|Outputs=
Line 15: Line 15:


Indirect decrements can be commonly found in legacy content that has been migrated from other platforms.
Indirect decrements can be commonly found in legacy content that has been migrated from other platforms.
Indirect decrements take Variable ([[Type:Variable|Variable]]) as an input, and will decrease the value that is wrapped by Variable ([[Type:Variable|Variable]]) by one.  
Indirect decrements take Variable ([[Type:IVariable`2|Variable]]) as an input, and will decrease the value that is wrapped by Variable ([[Type:IVariable`2|Variable]]) by one.  


{{Note|Keep in mind this node will only work if given variables that can be decremented. Trying to decrement a non numeric value like a [[Type:Bool|Boolean]] will not work. |information}}
{{Template:Basic Writes Info|Indirect Decrements}}


This is also useful for [[ProtoFlux:Multiplex|Multiplexing]] multiple variables into the Variable ([[Type:Variable|Variable]]) connection on the indirect decrement, which can be useful to reduce the nodes needed to decrease the values of a set list of variables during a [[ProtoFlux:For|For]] or [[ProtoFlux:While|While]] loop.
{{Note|Keep in mind this node will only work if given variables that can be decremented. Trying to decrement a non numeric value like a [[Type:Bool|Boolean]] or an [[:Category:Enums|Enum]] will not work. |information}}
 
{{Template:How To Make Type Variables|Indirect Decrements}}


== Inputs ==
== Inputs ==


=== * (Call) ===  
=== * ([[Impulses|Call]]) ===  


Call this to write the value.
Call this to write the value.


=== Variable ([[Type:Variable|Variable]] Generic)===
=== Variable ([[Type:IVariable`2|Variable]] Generic)===


The [[Type:Variable|Variable]] to decrement by 1.
The [[Type:IVariable`2|Variable]] to decrement by 1.


== Outputs ==
== Outputs ==


=== OnWritten (Continuation) ===
=== OnWritten ([[Impulses|Continuation]]) ===


sends an impulse after * (Call) has been impulsed and the value has been decremented .
sends an impulse after * ([[Impulses|Call]]) has been impulsed and the value has been decremented .


=== OnFail (Continuation) ===
=== OnFail ([[Impulses|Continuation]]) ===


sends an impulse after * (Call) has been impulsed and the value wasn't able to be decremented due to a missing target or the variable not wrapping a valid [[Type:IField`1|IField`1]]
sends an impulse after * ([[Impulses|Call]]) has been impulsed and the value wasn't able to be decremented due to a missing target or the variable not wrapping a valid [[Type:IField`1|IField`1]]


== Examples ==
== Examples ==


{{Stub}}
<gallery widths=480px heights=480px>
File:Protoflux_example_multiplexing_variables.webp|How to use multiplexing on an indirect node type to switch variables using a for loop.
File:Protoflux_example_source_to_indirect_variable.webp|How to use a source to make an indirect variable.
File:Protoflux_example_indirect_decrement.webp|How to use a simple indirect decrement setup.
</gallery>
 


[[Category:ProtoFlux:Actions:Indirect]]
[[Category:ProtoFlux:Actions:Indirect]]

Revision as of 19:01, 9 February 2024

Indirect Decrement
*
OnWritten
Variable
OnFail
Indirect

Indirect decrements can be commonly found in legacy content that has been migrated from other platforms. Indirect decrements take Variable (Variable) as an input, and will decrease the value that is wrapped by Variable (Variable) by one.

Indirect Decrements are a way to change a specified value without driving it. Instead you can use Indirect Decrements to change a value in a similar fashion to changing the value through the inspector. Using Indirect Decrements helps with performance too, since the values provided to the node only evaluate for one game tick while the node is being impulsed vs a driver which evaluates every game tick. This can also be used to reduce the amount of times code is evaluated. If you have to search the entire root for your code to find a slot and then do an operation, using Indirect Decrements with your operations will help with performance since you're only searching once and not every single game tick.

Keep in mind this node will only work if given variables that can be decremented. Trying to decrement a non numeric value like a Boolean or an Enum will not work.

Variables for Indirect Decrements can be made using a Field As Variable which can wrap any type (Generic). Variables can also be made by dragging a source of the same wrapped type (ex:Source<String> -> Variable<String>) into any variable input and it will make a special converter to connect them. This can be multiplexed using Multiplexing for using multiple variables into the same input on Indirect Decrements. Multiplexing the inputs on Indirect Decrements can be useful in modifying a list of variables during a For or While loop.

Inputs

* (Call)

Call this to write the value.

Variable (Variable Generic)

The Variable to decrement by 1.

Outputs

OnWritten (Continuation)

sends an impulse after * (Call) has been impulsed and the value has been decremented .

OnFail (Continuation)

sends an impulse after * (Call) has been impulsed and the value wasn't able to be decremented due to a missing target or the variable not wrapping a valid IField`1

Examples