ProtoFlux:FireOnChange: Difference between revisions

From Resonite Wiki
add info, standardize, add example with a missing image link for later
across updates
 
(14 intermediate revisions by 7 users not shown)
Line 13: Line 13:
|}}
|}}


Fire on change is a protoflux node that listens for changes to a value on the local client specified by OnlyForUser ([[Type:User|User]]). values that have imprecision or the Value (Generic) itself changes a lot, it could lead to undesired behavior and might be better to use [[Fire On True (ProtoFlux)| Fire On True]] and [[Fire On False (ProtoFlux)| Fire On False]].
The '''FireOnChange''' node will [[Type:IExecutionChangeListener`1|listen]] for changes on its input and fire an [[impulses|impulse]] for the specified [[user]] whenever there is a change in value across [[update|updates]].


This can be useful for providing complex behavior for a specific user whenever a value changes that existing components do not provide.


== Inputs ==
== Inputs ==


=== OnlyForUser ([[Type:User|User]]) ===  
=== OnlyForUser ([[Type:User|User]]) ===


is the one "watching" for changes, if the Value (Generic) is localized and only changes for the OnlyForUser User, then it will send out a impulse for every change vs someone else who wouldn't see those changes.
The user that will listen to changes and fire the impulse.
 
{{FireOn user information}}


=== Value (Generic) ===
=== Value (Generic) ===


The value that OnlyForUser ([[Type:User|User]]) should watch for changes on their client.
The value or object that should be listened to for changes.


== Outputs ==  
== Outputs ==


=== OnChanged ([[Impulses|impulse]]) ===
=== OnChanged ([[Impulses|impulse]]) ===


Will fire a single [[Impulses|impulse]] from the OnlyForUser ([[Type:User|User]]) input every time the value provided changes.
Fires a single [[Impulses|impulse]] from the specified user whenever the provided input changes value across updates.


== Examples ==
== See also ==


<gallery widths=480px heights=480px>
* [[ProtoFlux:FireOnLocalChange]] will fire an impulse for <em>every</em> user that detects a change rather than a specific user.
File:Protoflux_example_Fire_On_Change.webp|Fire On Change being used to tell when someone is on the ground according to the host user of a session.
* [[ProtoFlux:FireOnTrue]]
</gallery>
* [[ProtoFlux:FireOnFalse]]


[[Category:ProtoFlux:Flow]]
[[Category:ProtoFlux:Flow]]
[[Category:Listener nodes]]

Latest revision as of 08:48, 19 September 2025

Fire On Change
OnlyForUser
OnChanged
Value
Flow

The FireOnChange node will listen for changes on its input and fire an impulse for the specified user whenever there is a change in value across updates.

This can be useful for providing complex behavior for a specific user whenever a value changes that existing components do not provide.

Inputs

OnlyForUser (User)

The user that will listen to changes and fire the impulse.

For best practice, this should never be left null or evaluated differently based on the user (e.g. via LocalUser). If this input is null and the node is parented under a user, then the impulse will be fired for said user. If this input is null and not parented under a user, or if this input evaluates differently for different users, then the impulse will tend to be fired for the first user that sees the change in value. This is usually the one who caused the change in the first place. This could cause inconsistent behavior unless carefully managed.

Value (Generic)

The value or object that should be listened to for changes.

Outputs

OnChanged (impulse)

Fires a single impulse from the specified user whenever the provided input changes value across updates.

See also