π₯ Once
π₯ Once
The Once block allows you to limit the execution of a flow to a single occurrence, acting as a logical "gate" (DoOnce/Gate). It blocks subsequent passages after first use, while providing controls to reset its state.
This block is ideal for preventing unwanted repetitions (e.g. multiple triggering of a trap) or guaranteeing the uniqueness of an action (e.g. distribution of a reward).
π₯ Entries
- in (Flow): Input flow to execute if the block is open. Once passed, the block closes automatically.
- open (Control flow): Forces the block to open, allowing the
inflow to pass again. - close (Control flow): Forces the block to close, blocking any further passage.
- toggle (Control flow): Inverts the current state of the block (open β closed / closed β open).
- closed (Boolean): Initial state of the block upon loading (
True= closed,False= open by default).
π€ Outings
- out (Flow): Output flow activated only if the block was open when
inwas triggered.
π‘ Example of use
Scenario: Single-use emergency button
- A red βAlertβ button is placed in a level.
- Clicking on this button is connected to the in input of the Once block (set to
closed = False). - The out output triggers an audible alarm and sends a message to the guards.
- The player presses once: the alarm goes off, and the block closes automatically.
- The player presses again: nothing happens, because the block is now closed.
- To reset the button (e.g. after a level reset), a stream is connected to the open input.
βοΈ Technical Details
- Internal behavior: The block maintains a persistent
closedstate. Triggeringintoggles this state fromopentoclosedby default. - Priority management: The
open,closeandtoggleentries take precedence over the current state and can modify it at any time.
Updated on: 04/03/2026
Thank you!
