Dynamic Impulses: Difference between revisions

From Resonite Wiki
m fix links
Added some stuff
Line 18: Line 18:


<!--T:7-->
<!--T:7-->
Optionally, dynamic impulses can also carry a single value. This value is taken by the trigger and produced by the receiver.
Optionally, dynamic impulses can also carry a single value or reference. ProtoFlux nodes that can do this are [[ProtoFlux:Dynamic Impulse Trigger With Data|Dynamic Impulse Trigger With Data]] and [[ProtoFlux:Dynamic Impulse Receiver With Data|Dynamic Impulse Receiver With Data]]. There are also component variants, like [[Component:ButtonDynamicImpulseTriggerWithReference|Button Dynamic Impulse Trigger With Reference]] and [[Component:ButtonDynamicImpulseTriggerWithValue|Button Dynamic Impulse Trigger With Value]]. The value is sent by the trigger and received by the receiver.


= Specifics = <!--T:8-->
= Specifics = <!--T:8-->

Revision as of 05:29, 3 February 2024


Dynamic impulses allow for impulses to travel to other ProtoFlux programs anywhere in the world, and allow for large, complex programs to be built out of simple pieces.

Usage

There are two main parts to dynamic impulses: triggers and receivers.

A receiver takes a string tag. This tag determines what it listens for; when a dynamic impulse is triggered with the correct tag, an impulse will flow out of the node.

A trigger takes a slot to target and a tag to use. Every receiver under the targeted slot with a matching tag will be triggered.

Optionally, dynamic impulses can also carry a single value or reference. ProtoFlux nodes that can do this are Dynamic Impulse Trigger With Data and Dynamic Impulse Receiver With Data. There are also component variants, like Button Dynamic Impulse Trigger With Reference and Button Dynamic Impulse Trigger With Value. The value is sent by the trigger and received by the receiver.

Specifics

Dynamic Impulse Trigger and Dynamic Impulse Receiver are used for dynamic impulses that do not include a value.

A dynamic impulse trigger sends the impulse it received to all matching receivers.

Importantly, this means that anything available in the context of the triggering impulse, such as the collider that a collision occurred with, is also available to the receivers. This also makes dynamic impulses instant. If there are several receivers, they run in order; they will never run simultaneously. An infinite loop of dynamic impulses will eventually cause the involved nodes to break.