LUIDA Docs

Sleep

These pages are not yet fully reviewed. The LUIDA team is continuing to review and improve them. If you find anything wrong on these pages, or have questions that aren't resolved by reading them, please ask or report to the LUIDA team.

Sleep(seconds)StableUser Feedback & Utilities
Fires
On State Start · During State · On State Exit

Description

Pauses the execution of subsequent actions in the current list for a specified duration. Note: This has no direct ClusterScript function equivalent.

Parameters

NameTypeDescription
secondsnumber

Side effects

  • No state writes, no signals, no $.groupState mutations. Sleep is a marker action emitted as { type: "sleep", value: <seconds> } in the generated action list.
  • StateListeningItemBase.js advances the action chain in OnStateEnter / OnStateExit until it hits a sleep marker, then defers further actions until timer >= seconds of accumulated deltaTime.
  • Only meaningful inside On State Start or On State Exit chains. DuringState runs every frame and skips sleep markers (if (... === "sleep") $.state.duringStateActionID += 1; else ...), so blocking on Sleep there is a no-op — and trying to "wait between per-frame steps" usually means you wanted a Customized Action with your own timer.

Example

A clean inter-stimulus interval — flash a stimulus for 1.5 s on state enter, then hide it:

// On State Start
ShowItem();
SetText("Press the matching button.");
Sleep(1.5);
HideItem();

The action chain pauses at Sleep(1.5); after 1.5 s of accumulated deltaTime the runtime resumes and runs HideItem() on the next frame.

For longer pauses tied to a state itself (e.g. a 3-second rest screen), prefer setting an exit timer on the state in the State Machine tab — it's clearer in the UI and works with any action type.

Source

Assets/Doc/LUIDA-StateListeningItemScriptDoc.md