ProtoFlux:Increment: Difference between revisions

From Resonite Wiki
m forgot one
Added "the". Added "instead".
 
(2 intermediate revisions by 2 users not shown)
Line 18: Line 18:




Increments take Variable ([[Type:IVariable`2|Variable]] Sudo-Generic) as a global, and will increase the value that Variable ([[Type:IVariable`2|Variable]] Sudo-Generic) points to by 1.
Increments take Variable ([[Type:IVariable`2|Variable]] Pseudo-generic) as a global, and will increase the value that Variable ([[Type:IVariable`2|Variable]] Pseudo-generic) points to by 1.


{{Note|Keep in mind this node will only work if given variables that can be incremented. Trying to increment a non numeric value like a [[Type:Bool|Boolean]] or an [[:Category:Enums|Enum]] will not work. |information}}
{{Note|Keep in mind this node will only work if given variables that can be incremented. Trying to increment a non numeric value like a [[Type:Bool|Boolean]] or an [[:Category:Enums|Enum]] will not work. |information}}
Line 25: Line 25:


{{Template:Direct Writes Info|Increments}}
{{Template:Direct Writes Info|Increments}}
{{Note|If you just need to add + 1 to your [[Value Type|value]] using pure data, use the [[ProtoFlux:Value Inc|Value Inc]] node instead.
If you need to add more than + 1 to your [[Value Type|value]], use the [[ProtoFlux:Add|Add]] node instead.|suggestion}}


== Inputs ==
== Inputs ==
Line 36: Line 40:
=== OnWritten ([[Impulses|Continuation]]) ===
=== OnWritten ([[Impulses|Continuation]]) ===


sends an impulse after * ([[Impulses|Call]]) has been impulsed and the value pointed to by Variable ([[Type:IVariable`2|Variable]] Sudo-Generic) has been incremented.
sends an impulse after * ([[Impulses|Call]]) has been impulsed and the value pointed to by Variable ([[Type:IVariable`2|Variable]] Pseudo-generic) has been incremented.


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


sends an impulse after * ([[Impulses|Call]]) has been impulsed and the value wasn't able to be incremented due to a missing target or Variable ([[Type:IVariable`2|Variable]] Sudo-Generic) not pointing to a valid [[Type:IField`1|IField`1]].
sends an impulse after * ([[Impulses|Call]]) has been impulsed and the value wasn't able to be incremented due to a missing target or Variable ([[Type:IVariable`2|Variable]] Pseudo-generic) not pointing to a valid [[Type:IField`1|IField`1]].


== Globals ==
== Globals ==


=== Variable ([[Type:IVariable`2|Variable]] Sudo-Generic) ===
=== Variable ([[Type:IVariable`2|Variable]] Pseudo-generic) ===


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

Latest revision as of 14:54, 27 June 2024

+ +
*
OnWritten
OnFail
Variable
null
Actions


Increments take Variable (Variable Pseudo-generic) as a global, and will increase the value that Variable (Variable Pseudo-generic) points to by 1.

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

Increments are a way to change a specified value without driving it. Instead you can use Increments to change a value in a similar fashion to changing the value through the inspector. Using Increments 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 Increments with your operations will help with performance since you're only searching once and not every single game tick.

When it comes to Increments, you can drag any matching typed source onto the Variable field to set that as the variable target. When you want to write to a Local Variable Store, Data Model Variable Store, or a Store Variable Store, you can grab the Variable field on Increments nodes and then choose the one you want in your context menu. This can save considerable time spent trying to find the type you want in another node menu.

If you just need to add + 1 to your value using pure data, use the Value Inc node instead.

If you need to add more than + 1 to your value, use the Add node instead.

Inputs

* (Call)

Call this to write the value.

Outputs

OnWritten (Continuation)

sends an impulse after * (Call) has been impulsed and the value pointed to by Variable (Variable Pseudo-generic) has been incremented.

OnFail (Continuation)

sends an impulse after * (Call) has been impulsed and the value wasn't able to be incremented due to a missing target or Variable (Variable Pseudo-generic) not pointing to a valid IField`1.

Globals

Variable (Variable Pseudo-generic)

The numeric Variable to increment by 1.

Examples