Finish the page for now |
m oops |
||
(5 intermediate revisions by the same user not shown) | |||
Line 4: | Line 4: | ||
|Inputs= | |Inputs= | ||
[ | [ | ||
{"Name":"*", "Type":" | {"Name":"*", "Type":"Call"}, | ||
{"Name":"Value", "Type":"Dummy"} | {"Name":"Value", "Type":"Dummy"} | ||
] | ] | ||
Line 14: | Line 14: | ||
|Globals= | |Globals= | ||
[ | [ | ||
{"Name":"Variable", "Type":" | {"Name":"Variable", "Type":"IVariable`2"} | ||
] | ] | ||
|}} | |}} | ||
Writes take Variable ([[Type: | Writes take Variable ([[Type:IVariable`2|Variable]]) as an input, and the type that Variable wraps will determine what Value (Generic) will take as a value. The node will then write Value (Generic) to the field Variable ([[Type:IVariable`2|Variable]]) wraps. | ||
{{Template:Direct Writes Info|Writes}} | |||
{{Template:Basic Writes Info|Writes}} | {{Template:Basic Writes Info|Writes}} | ||
Line 26: | Line 26: | ||
== Inputs == | == Inputs == | ||
=== * (Call) === | === * ([[Impulses|Call]]) === | ||
Call this to write the value. | Call this to write the value. | ||
Line 32: | Line 32: | ||
=== Value (Generic) === | === Value (Generic) === | ||
[[:Category:Type|Value]] to write to the value pointed to by Variable ([[Type: | [[:Category:Type|Value]] to write to the value pointed to by Variable ([[Type:IVariable`2|Variable]]) | ||
== Outputs == | == Outputs == | ||
=== OnWritten (Continuation) === | === OnWritten ([[Impulses|Continuation]]) === | ||
sends an impulse after * (Call) has been impulsed and the value has been written. | sends an impulse after * ([[Impulses|Call]]) has been impulsed and the value has been written. | ||
=== OnFail (Continuation) === | === OnFail ([[Impulses|Continuation]]) === | ||
sends an impulse after * (Call) has been impulsed and the value wasn't able to be written due to a missing target or a missing Variable ([[Type: | sends an impulse after * ([[Impulses|Call]]) has been impulsed and the value wasn't able to be written due to a missing target or a missing Variable ([[Type:IVariable`2|Variable]]) value | ||
== Globals == | == Globals == | ||
=== Variable ([[Type: | === Variable ([[Type:IVariable`2|Variable]] Generic)=== | ||
The [[Type: | The [[Type:IVariable`2|Variable]] to write to. | ||
== Examples == | == Examples == | ||
<gallery widths=480px heights=480px> | |||
File:Protoflux_example_write.webp|Example of a write node set up to write text to a data model store variable | |||
</gallery> | |||
[[Category:ProtoFlux:Actions]] |
Latest revision as of 19:15, 9 February 2024
Writes take Variable (Variable) as an input, and the type that Variable wraps will determine what Value (Generic) will take as a value. The node will then write Value (Generic) to the field Variable (Variable) wraps.
When it comes to Writes, 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 Writes 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.
Writes are a way to change a specified value without driving it. Instead you can use Writes to change a value in a similar fashion to changing the value through the inspector. Using Writes 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 Writes with your operations will help with performance since you're only searching once and not every single game tick.
Inputs
* (Call)
Call this to write the value.
Value (Generic)
Value to write to the value pointed to by Variable (Variable)
Outputs
OnWritten (Continuation)
sends an impulse after * (Call) has been impulsed and the value has been written.
OnFail (Continuation)
sends an impulse after * (Call) has been impulsed and the value wasn't able to be written due to a missing target or a missing Variable (Variable) value
Globals
Variable (Variable Generic)
The Variable to write to.
Examples
-
Example of a write node set up to write text to a data model store variable