ProtoFlux:Delay: Difference between revisions

From Resonite Wiki
m ProbablePrime moved page Delay (ProtoFlux) to ProtoFlux:Delay: Creating protoflux Namespace
added example image
 
(10 intermediate revisions by 4 users not shown)
Line 4: Line 4:
|Inputs=
|Inputs=
[
[
{"Name": "*", "Type": "AsyncImpulse"},
{"Name": "*", "Type": "AsyncCall"},
{"Name": "Duration", "Type": "Dummy"}
{"Name": "Duration", "Type": "Dummy"}
]
]
Line 10: Line 10:
[
[
{"Name": "Next", "Type":"Continuation"},
{"Name": "Next", "Type":"Continuation"},
{"Name": "OnTriggered", "Type":"AsyncImpulse"}
{"Name": "OnTriggered", "Type":"AsyncCall"}
]
]
|}}
|}}


Accepted types for <code>Duration</code> are: [[Type:Double | Double]], [[Type:Float | Float]], [[Type:Int | Int]] and [[Type:TimeSpan | TimeSpan]].
Delay is a ProtoFlux node that allows for delaying an [[Impulses#Async|Async]] execution for the provided Duration (Pseudo-generic) before continuing.
 
== Inputs ==
 
=== * ([[Impulses#Async|AsyncCall]]) ===
 
Start the delay.
 
=== Duration (Pseudo-generic) ===
 
How long to delay for in seconds or timespan.
 
Examples: [[Type:Double | Double]], [[Type:Float | Float]], [[Type:Int | Int]] and [[Type:TimeSpan | TimeSpan]].
 
{{Note|Delays of less than 0.5 milliseconds will be rounded to zero and may cause Resonite to hang if used inside of a loop.|danger}}
 
== Outputs ==
 
=== Next ([[Impulses|Continuation]]) ===
 
Fires on the next game tick once the given duration has passed since the Delay was triggered '''and''' ''OnTriggered'' has finished. If ''OnTriggered'' takes longer than the delay duration to finish, ''Next'' will be executed immediately after.
 
=== OnTriggered ([[Impulses#Async|AsyncCall]]) ===
 
Fires immediately after the Delay is triggered. This impulse chain will block ''Next'', e.g. if it contains another Delay with a higher duration.
 
== Examples ==
 
<gallery widths=480px heights=160px>
File:Protoflux_example_Delay.webp|A [[wikipedia:Useless_machine|"Useless Machine"]] that resets itself a second after pressing the [[ProtoFlux:Async_Call_Input|Async Call Input]]. Note that every click will cause a delayed impulse that will reset the state. This may be unwanted if the goal is to reset a second after the last press.
</gallery>


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

Latest revision as of 14:49, 1 December 2024

Delay
*
Next
Duration
OnTriggered
Flow

Delay is a ProtoFlux node that allows for delaying an Async execution for the provided Duration (Pseudo-generic) before continuing.

Inputs

* (AsyncCall)

Start the delay.

Duration (Pseudo-generic)

How long to delay for in seconds or timespan.

Examples: Double, Float, Int and TimeSpan.

Delays of less than 0.5 milliseconds will be rounded to zero and may cause Resonite to hang if used inside of a loop.

Outputs

Next (Continuation)

Fires on the next game tick once the given duration has passed since the Delay was triggered and OnTriggered has finished. If OnTriggered takes longer than the delay duration to finish, Next will be executed immediately after.

OnTriggered (AsyncCall)

Fires immediately after the Delay is triggered. This impulse chain will block Next, e.g. if it contains another Delay with a higher duration.

Examples