Skip to reading
Visual Scripting in Depth

15. Give the puzzle a memory

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

Variables remember what has happened. A door needs a door_open flag. A collectible needs a key_taken flag. A score is a number. Good variables let the graph ask a clear question instead of trying to infer the entire puzzle from what happens to be visible.

Source table from 15. Give the puzzle a memory, page 19
IDTypeStarting valuePurpose
key_takenBooleanfalsePrevents a second pickup reward.
door_openBooleanfalseRecords the completed door puzzle.
scoreNumber0Tracks the points awarded.
pulse_countNumber0Counts a demonstration loop.
loop_indexNumber0Receives the For Loop index.
last_targetStringempty textStores an event entity ID.
busyBooleanfalsePrevents overlapping starts when required.

1. Open Variable Designer and add the variables your lesson needs.

2. Give each a stable ID, a readable name and the appropriate type.

3. Set the starting value, apply and save.

4. Return to the graph and choose the variable from the relevant dropdown.

5. Restart the preview to test those authored starting values.

Use a Boolean for a yes/no state. A text value containing the word false is not the Boolean false. A missing variable is also not the same as a correctly initialized false flag.

Declare important puzzle state in Variable Designer even though several runtime nodes can create destinations by name. Declared variables are easier to discover, inspect and maintain.

Page 19 of 93Permalink
Go to page