add template |
m fix types |
||
Line 4: | Line 4: | ||
|Inputs= | |Inputs= | ||
[ | [ | ||
{"Name":"*", "Type":" | {"Name":"*", "Type":"Call"} | ||
] | ] | ||
|Outputs= | |Outputs= | ||
Line 13: | Line 13: | ||
|Globals= | |Globals= | ||
[ | [ | ||
{"Name":"Variable", "Type":" | {"Name":"Variable", "Type":"IVariable`2"} | ||
] | ] | ||
|}} | |}} | ||
Decrements take Variable ([[Type: | Decrements take Variable ([[Type:IVariable`2|Variable]] Sudo-Generic) as a global, and will decrease the value that Variable ([[Type:IVariable`2|Variable]] Sudo-Generic) points to by 1. | ||
{{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}} | {{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}} | ||
Line 36: | Line 36: | ||
=== OnWritten ([[Impulses|Continuation]]) === | === OnWritten ([[Impulses|Continuation]]) === | ||
sends an impulse after * ([[Impulses|Call]]) has been impulsed and the value pointed to by Variable ([[Type: | sends an impulse after * ([[Impulses|Call]]) has been impulsed and the value pointed to by Variable ([[Type:IVariable`2|Variable]] Sudo-Generic) has been decremented. | ||
=== OnFail ([[Impulses|Continuation]]) === | === OnFail ([[Impulses|Continuation]]) === | ||
sends an impulse after * ([[Impulses|Call]]) has been impulsed and the value wasn't able to be decremented due to a missing target or Variable ([[Type: | sends an impulse after * ([[Impulses|Call]]) has been impulsed and the value wasn't able to be decremented due to a missing target or Variable ([[Type:IVariable`2|Variable]] Sudo-Generic) not pointing to a valid [[Type:IValue`1|IValue`1]]. | ||
== Globals == | == Globals == | ||
=== Variable ([[Type: | === Variable ([[Type:IVariable`2|Variable]] Sudo-Generic) === | ||
The numeric [[Type: | The numeric [[Type:IVariable`2|Variable]] to decrement by 1. | ||
== Examples == | == Examples == |
Revision as of 19:07, 9 February 2024
Decrements take Variable (Variable Sudo-Generic) as a global, and will decrease the value that Variable (Variable Sudo-Generic) points to by 1.
Decrements are a way to change a specified value without driving it. Instead you can use Decrements to change a value in a similar fashion to changing the value through the inspector. Using 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 Decrements with your operations will help with performance since you're only searching once and not every single game tick.
When it comes to Decrements, 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 Decrements 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.
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 Sudo-Generic) 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 Variable (Variable Sudo-Generic) not pointing to a valid IValue`1.
Globals
Variable (Variable Sudo-Generic)
The numeric Variable to decrement by 1.
Examples
-
How to use a simple decrement setup.