Unlock a door at 10:09
WORKED EXAMPLE / VISUAL SCRIPTING
Check the two hands that matter and latch the result. This keeps the door from unlocking again when someone moves the second hand.
Create the number variable clock_open, initially 0. For a puzzle that starts 1 unsolved, initialize the hands and their variables to hour 10 and minute 8. Make a visual script called check_clock.
Add three If Variable nodes. Each has Variable and Equals fields. Set them as 2 shown. Use numeric values. Connect each true or false output to the named destination. Add the clock_open check first in an empty graph. Drag from each output port to the input on the next node. The table gives the destination for each port.
| Node | True output | False output |
|---|---|---|
| clock_open equals 0 | Check hour | End |
| hour equals 10 | Check minute | End |
| minute equals 9 | Set Variable: clock_open = 1 | End |
After Set Variable, attach the action that opens the door, reveals a clue, or plays 3 the reward sound. Set the flag first so another movement cannot repeat the reward. In the clock’s Events → Turn, select run-visual-script and set Turn Target to check_clock. Save.
Start Runtime Preview. At 10:08 the flag should be 0. Turn only the minute hand 4 one step to 9. The flag should become 1. Turn it to 10 and back to 9. The reward should still have happened once.
When only one hand should trigger a sound#
At the graph entry, use Read Context with Context Key handleId and Store in Variable moved_hand (a text variable). Compare it to "minute" before playing the tick. The IDs survive changes in hand order.
