Skip to reading
Visual Scripting in Depth

50. Filter listeners and prevent event loops

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

Figure 33. The listener checks its context tag before changing state.

1. Put the event filter immediately after On Event.

2. Leave the irrelevant branch unconnected, or end it explicitly.

3. Check a completion or busy flag before performing one-time work.

4. Set that guard before the first wait or outgoing event.

5. If the listener changes the system it listens to, test whether that change emits another event.

6. Confirm that repeated unrelated events leave the puzzle unchanged.

An OnInventoryChanged listener that adds another item can trigger another inventory notification. An OnCustomEvent listener that emits the same tag can call itself. A short guard is easier to understand than relying on a nesting or step limit to stop the chain.

A listener can use a variable gate, such as effects_enabled or hints_enabled, when its response should be optional. The Functions as Nodes exposure checkbox controls the function catalog; it is not an on/off switch for an On Event entry.

Event timing can be deferred by the system that emits it. Do not assume every notification has already run immediately after an inventory action. Test the resulting behavior through the normal game flow.

Page 54 of 93Permalink
Go to page