Skip to reading
Action Lists & Events

25. Use context instead of guessing

Edition 0.86.4.3

0.86.4.3 edition with revised lessons, updated cross-references and new cinematic/camera-safety supplements. Earlier examples, screenshots and registry figures retain their stated edition context.

Download PDFView PDF page

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.

Source table from 25. Use context instead of guessing, page 29
CallerTypical useful keys
Room local action listsceneId, roomEvent.
Scene verb responseentityId, targetEntityId, targetKind, verb, inventoryItemId, sourceItemId.
Trigger local action listentityId, triggerEvent; event/body data where supplied.
Shared trigger eventtriggerId, entityId, sceneId, playerId, event; regionId for a region.
GUI element eventguiId, guiElementId, eventName such as GUI.click, guiEvent.
Inventory verbitemId, inventoryItemId, verb.
Inventory combinationsourceItemId, targetItemId, inventoryItemId, targetKind.
Custom eventThe 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.

Page 29 of 189Permalink
Go to page