25. Use context instead of guessing
Context is information about this particular call. A trigger event can identify its trigger; a GUI event can identify the GUI and element; an inventory combination can identify the source and target item. Different event routes supply different keys.
| Caller | Typical useful keys |
|---|---|
| Room local action list | sceneId, roomEvent. |
| Scene verb response | entityId, targetEntityId, targetKind, verb, inventoryItemId, sourceItemId. |
| Trigger local action list | entityId, triggerEvent; event/body data where supplied. |
| Shared trigger event | triggerId, entityId, sceneId, playerId, event; regionId for a region. |
| GUI element event | guiId, guiElementId, eventName such as GUI.click, guiEvent. |
| Inventory verb | itemId, inventoryItemId, verb. |
| Inventory combination | sourceItemId, targetItemId, inventoryItemId, targetKind. |
| Custom event | The dictionary sent by the emitter. |
Use event.get("key", fallback) in a text handler when the key may be absent. In visual graphs, Read Context can copy a value into a game variable. An expression such as {"$context":"entityId"} reads the current call's value directly.
The shared OnInteraction payload includes more keys than the local verb list that follows it. In this build the local list drops some shared scene/player/character keys. Code against the route you actually use, not against a combined imaginary payload.
