27. Read the event context
Figure 19. Return can assemble a dictionary from the caller and explicit event fields.
1. Add Read Context after the entry.
2. Set Context Key to entityId.
3. Set Store in Variable to last_target.
4. Call the graph through an object event.
5. Inspect last_target; it should contain that object’s live ID.
| Context key | Common source |
|---|---|
| entityId / verb | A scene object interaction. |
| itemId / amount / operation | Inventory-change notifications. |
| guiId / guiElementId / guiEvent | A GUI element event. |
| sceneId / previousSceneId / firstVisit | OnSceneLoaded. |
| triggerId / playerId | Trigger entry and exit. |
| arguments | Arguments supplied by a script call. |
Context fields depend on the event. Read Context copies the exact field; a missing field produces null. It does not infer a target from whatever the mouse happens to point at.
Choose the key that answers the question. OnInventoryChanged includes the active character and the changed item; read itemId explicitly when you mean the item. The captured caller and an individual context field need not be the same record.
