ProtoFlux:Fire On Change: Difference between revisions

From Resonite Wiki
needs to be standardized. marking as stub
 
(12 intermediate revisions by 4 users not shown)
Line 9: Line 9:
|Outputs=
|Outputs=
[
[
{"Name": "OnChanged", "Type":"Impulse"}
{"Name": "OnChanged", "Type":"Call"}
]
]
|}}
|}}


{{Stub}}
{{Template:Basic Fire On Information|Fire On Change|change|the OnlyForUser ([[Type:User|User]]) provided|[[ProtoFlux:Fire On Local Change|Fire On Local Change]]}}
<i>This page needs Standardization with [[Example ProtoFlux Node]]</i>


Will fire a single impulse from the OnlyForUser User input every time the value provided changes.
This node '''does not''' runs the calculation on every frame<ref>Nuki's message on Discord (requires account) https://discord.com/channels/1040316820650991766/1154514007479287942/1251599026479169627</ref><ref>Frooxiu's messge on Dicord (requires account) https://discord.com/channels/1040316820650991766/1154514007479287942/1251600403926351933</ref>.


OnlyForUser User is the one "watching" for changes, if the Value is localized and only changes for the OnlyForUser User, then it will send out a impulse for every change.
== Inputs ==


For values that have imprecision or the Value 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]].
=== OnlyForUser ([[Type:User|User]]) ===
 
Is the User "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.
 
{{FireOnUserInformation}}
 
=== Value (Generic) ===
 
The value or reference that OnlyForUser ([[Type:User|User]]) should watch for changes on their client.
 
== Outputs ==
 
=== OnChanged ([[Impulses|impulse]]) ===
 
Will fire a single [[Impulses|impulse]] from the OnlyForUser ([[Type:User|User]]) input every time the value provided changes.
 
== Use Notes ==
Because FireOnChange functions based on the trigger for whatever node it is connected to, it may not fire when the node it is connected to is changed if that node does not account for the calculation before it.  Therefore, if a node is firing unreiably, an easy fix would be to connect FireOnChange's value to a node below it, preferably whatever value is most critical to the change.[1]
 
== Examples ==
 
<gallery widths=480px heights=480px>
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.
</gallery>
 
== See Also ==
* [[ProtoFlux:Fire On True]]
* [[ProtoFlux:Fire On False]]
 
== Sources ==
<references />


[[Category:ProtoFlux:Flow]]
[[Category:ProtoFlux:Flow]]

Latest revision as of 22:34, 15 June 2024

Fire On Change
OnlyForUser
OnChanged
Value
Flow
Using this node with Local User or no user input may cause undesired outcomes.

Fire On Change Nodes will only fire if the OnlyForUser (User) provided has seen the value on their local machine change.

When this node triggers from the OnlyForUser (User) provided it can be used to execute code that requires the impulse be from a specific user. This is useful for things like:

  • changing world properties
  • physics
  • cloud variables
  • other Local User sensitive nodes.

This node does not runs the calculation on every frame[1][2].

Inputs

OnlyForUser (User)

Is the User "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.

Determining the Owner of the Impulse

When this node is used the user who fires the impulse is determined using the following steps:

  1. If the OnlyForUser (User) property is set to ProtoFlux:Local User, fire for all users in a session.
  2. If the OnlyForUser (User) property is not null only fire for this user.
  3. If the Node is parented under a User, fire only for that user.
  4. Otherwise fire for all users in a session.

Value (Generic)

The value or reference that OnlyForUser (User) should watch for changes on their client.

Outputs

OnChanged (impulse)

Will fire a single impulse from the OnlyForUser (User) input every time the value provided changes.

Use Notes

Because FireOnChange functions based on the trigger for whatever node it is connected to, it may not fire when the node it is connected to is changed if that node does not account for the calculation before it. Therefore, if a node is firing unreiably, an easy fix would be to connect FireOnChange's value to a node below it, preferably whatever value is most critical to the change.[1]

Examples

See Also

Sources