Skip to main content

gameModelScheduleInvoke

Arm a one-shot timer: invoke a function once, after a delay. The timer is durable (it survives an API restart) and claimed by exactly one replica, so it fires once. A timer whose deadline passes while the app has no players WAITS rather than firing into an empty world, and fires when somebody returns: late, not lost. Read the clock in the handler rather than assuming the delay you asked for is the delay that elapsed. The target function must be autonomousInvocable, because the fire is headless and runs with system authority rather than a player's — which is also why this needs app-admin ('manage_apps'). For player-driven delays, author a timers effect on a function instead so the delay is part of your game logic. Supply dedupeKey to make re-arming replace the pending timer rather than queue another fire.

gameModelScheduleInvoke(
input: ScheduleInvokeInput!
): GmTimer!

Arguments

gameModelScheduleInvoke.input ● ScheduleInvokeInput! non-null input

The app, function name, self container, delay in ms, and optional params, session, and dedupe key.

Type

GmTimer object

A pending one-shot timer: a delayed invocation that has been armed but has not fired yet. Timers are removed from this list the moment they are claimed for execution.