Events: phrases, shared hooks and payloads
On this page
Earlier edition reference / Current 0.86.4.0 property paths > p. 329
The following 18 entries map the shared runtime hooks to PCA source headers. IDs in the readable headers are examples: replace lab, welcome_trigger, elias_intro and media IDs with your own. Each handler ends with end.
PCA when handlers are discovered in enabled source records. They are not the same as merely naming a function after a native handler. Exact-name form, when event Name, matches the event name the runtime dispatches.
Event context is supplied by the emitter. Check optional keys and inspect event when debugging. return is only legal inside a function, not directly inside when. Put a handler’s work in a function when you need an early return, or guard it with if.
OnGameStart#
when game starts
log(to_json(event))
endThe runtime reaches its game-start hook. It is a game-session event, not a once-per-room event.
| Common context keys | Use and limits |
|---|---|
| sceneId, playerId | Initialize session-level logic here. Do not reset saved puzzle variables on every scene entry. A direct Test Scene can start a test session too; test a normal new game and a loaded game separately. |
OnSceneLoaded#
when room lab loads
log(to_json(event))
endA room has been constructed and its local entry actions have run.
| Common context keys | Use and limits |
|---|---|
| sceneId, previousSceneId, playerId, firstVisit | Filter sceneId before changing room-specific props. In the normal entry path, firstEnter runs before enter, then this event is emitted. It is not a substitute for the room's first-time event. |
