ProtoFlux:Indirect Write Latch: Difference between revisions

From Resonite Wiki
create indirect write latch page
 
m fix types
 
(5 intermediate revisions by the same user not shown)
Line 4: Line 4:
|Inputs=
|Inputs=
[
[
{"Name":"Set", "Type":"Impulse"},
{"Name":"Set", "Type":"Call"},
{"Name":"Reset", "Type":"Impulse"},
{"Name":"Reset", "Type":"Call"},
{"Name":"Variable", "Type":"Variable"},
{"Name":"Variable", "Type":"IVariable`2"},
{"Name":"SetValue", "Type":"Dummy"},
{"Name":"SetValue", "Type":"Dummy"},
{"Name":"ResetValue", "Type":"Dummy"}
{"Name":"ResetValue", "Type":"Dummy"}
Line 19: Line 19:


Indirect write latches can be commonly found in legacy content that has been migrated from other platforms.
Indirect write latches can be commonly found in legacy content that has been migrated from other platforms.
Indirect write latches take Variable ([[Type:Variable|Variable]]) as an input, and the type that Variable wraps will determine what SetValue (Generic) and ResetValue (Generic) will take as a value. The set and reset value inputs will never take different types from each other.
Indirect write latches take Variable ([[Type:IVariable`2|Variable]]) as an input, and the type that Variable wraps will determine what SetValue (Generic) and ResetValue (Generic) will take as a value. The set and reset value inputs will never take different types from each other.


This is also useful for [[ProtoFlux:Multiplex|Multiplexing]] multiple variables into the Variable ([[Type:Variable|Variable]]) connection on the indirect write latch, which can be useful to reduce the nodes needed to set and reset a list of variables during a [[ProtoFlux:For|For]] or [[ProtoFlux:While|While]] loop.
{{Template:Basic Writes Info|Indirect Write Latches}}
 
{{Template:How To Make Type Variables|Indirect Write Latches}}


== Inputs ==
== Inputs ==


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


Call this to set the value being wrapped by Variable ([[Type:Variable|Variable]] Generic) to the ResetValue (Generic) input.
Call this to set the value being wrapped by Variable ([[Type:IVariable`2|Variable]] Generic) to the ResetValue (Generic) input.


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


Call this to set the value being wrapped by Variable ([[Type:Variable|Variable]] Generic) to the SetValue (Generic) input.
Call this to set the value being wrapped by Variable ([[Type:IVariable`2|Variable]] Generic) to the SetValue (Generic) input.


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


The [[Type:Variable|Variable]] to write to.
The [[Type:IVariable`2|Variable]] to write to.


=== SetValue (Generic) ===
=== SetValue (Generic) ===


[[:Category:Type|Value]] to write to the value wrapped by Variable ([[Type:Variable|Variable]] Generic) upon calling Set (Call)  
[[:Category:Type|Value]] to write to the value wrapped by Variable ([[Type:IVariable`2|Variable]] Generic) upon calling Set ([[Impulses|Call]])  


=== ResetValue (Generic) ===
=== ResetValue (Generic) ===


[[:Category:Type|Value]] to write to the value wrapped by Variable ([[Type:Variable|Variable]] Generic) upon calling Reset (Call)  
[[:Category:Type|Value]] to write to the value wrapped by Variable ([[Type:IVariable`2|Variable]] Generic) upon calling Reset ([[Impulses|Call]])  


== Outputs ==
== Outputs ==


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


sends an impulse after SetValue (Call) has been impulsed and the value wrapped by Variable ([[Type:Variable|Variable]] Generic) has been set to SetValue (Generic).
sends an impulse after SetValue ([[Impulses|Call]]) has been impulsed and the value wrapped by Variable ([[Type:IVariable`2|Variable]] Generic) has been set to SetValue (Generic).


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


sends an impulse after ResetValue (Call) has been impulsed and the value wrapped by Variable ([[Type:Variable|Variable]] Generic) has been set to ResetValue (Generic).
sends an impulse after ResetValue ([[Impulses|Call]]) has been impulsed and the value wrapped by Variable ([[Type:IVariable`2|Variable]] Generic) has been set to ResetValue (Generic).


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


sends an impulse after either ResetValue (Call) or SetValue (Call) has been impulsed and the value wasn't able to be written due to a missing target or the variable not wrapping a valid [[Type:IField`1|IField`1]]
sends an impulse after either ResetValue ([[Impulses|Call]]) or SetValue ([[Impulses|Call]]) has been impulsed and the value wasn't able to be written due to a missing target or the variable not wrapping a valid [[Type:IValue`1|IValue`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_write_latch.webp|How to use a simple indirect write latch setup.
</gallery>


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

Latest revision as of 19:06, 9 February 2024

Indirect Write Latch
Set
OnSet
Reset
OnReset
Variable
OnFail
SetValue
ResetValue
Indirect

Indirect write latches can be commonly found in legacy content that has been migrated from other platforms. Indirect write latches take Variable (Variable) as an input, and the type that Variable wraps will determine what SetValue (Generic) and ResetValue (Generic) will take as a value. The set and reset value inputs will never take different types from each other.

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

Variables for Indirect Write Latches 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 Write Latches. Multiplexing the inputs on Indirect Write Latches can be useful in modifying a list of variables during a For or While loop.

Inputs

Reset (Call)

Call this to set the value being wrapped by Variable (Variable Generic) to the ResetValue (Generic) input.

Set (Call)

Call this to set the value being wrapped by Variable (Variable Generic) to the SetValue (Generic) input.

Variable (Variable Generic)

The Variable to write to.

SetValue (Generic)

Value to write to the value wrapped by Variable (Variable Generic) upon calling Set (Call)

ResetValue (Generic)

Value to write to the value wrapped by Variable (Variable Generic) upon calling Reset (Call)

Outputs

OnSet (Continuation)

sends an impulse after SetValue (Call) has been impulsed and the value wrapped by Variable (Variable Generic) has been set to SetValue (Generic).

OnReset (Continuation)

sends an impulse after ResetValue (Call) has been impulsed and the value wrapped by Variable (Variable Generic) has been set to ResetValue (Generic).

OnFail (Continuation)

sends an impulse after either ResetValue (Call) or SetValue (Call) has been impulsed and the value wasn't able to be written due to a missing target or the variable not wrapping a valid IValue`1

Examples