Skip to reading
Action Lists & Events

24. Emit and receive the custom event

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 illustrations

The name OnCustomEvent does not fire by itself when a variable changes. An emitter must send it. Add an Emit Event node after the lever's successful state change, or use the helper in a text script.

Code example
await EmitEvent("OnCustomEvent", {
    "reason": "signal_powered",
    "sourceId": "lever"
})

For a visual listener, add On Event and select OnCustomEvent. Connect it to Read Context, with Context Key reason and Store in Variable last_reason. Then connect to End. This graph listens automatically; do not also call it from the lever unless you want an additional direct execution.

Figure 20. An On Event entry reads information from the custom event payload.

The checked dispatcher awaits the text-language subscription routes before its On Event visual graphs. Do not rely on the order of several unrelated listener records as a puzzle scheduler. Put dependent work in one list or graph.

Do not emit the same event unconditionally from its own listener. It can call itself again. Filter the reason, use a guard variable, or emit a different notification that cannot loop back into the same work.

Page 28 of 189Permalink
Go to page