Skip to content

Async calls and task lifetime

Calls default to Await On. The called method begins immediately and runs until it completes or suspends. If it Waits, the caller waits for completion before continuing. A compatible result Variable can receive the return value.

Private parameters/locals belong to that call. Awaiting does not merge the caller’s and callee’s Private namespaces.

Mark the method Async, then disable Await on its call. Arguments are captured at the call, and an independent task starts next tick. The caller continues without a result. Detached work shares Public/Save state through normal bindings, while keeping isolated Private locals.

Use this for independent timers or background round behavior. Do not use it when the next block requires the method’s return value.

Two tasks may read and change Public/Save state at different times. A value checked before Wait may be stale afterward. Recheck round/player validity after suspending, and use a round identifier or explicit state to prevent old timers from changing a new round.

Reference inputs can share mutable collections. Capturing an argument is not automatically a deep snapshot; choose a copy mode if later mutations must be isolated.

An awaited child failure propagates through the caller’s handlers. An unhandled detached failure stops that task rather than unrelated tasks. All async work belongs to its plot and stops with the program. /plot diagnostics cancel <task> cancels one task; Finally cleanup is bounded and cannot suspend or start tasks during cancellation.

Constructors cannot Wait or start detached work, even through helper methods. Move timers and delayed gameplay into normal methods after construction.

For structured error recovery, see exceptions.