Skip to reading
GUI: Knobs, Dials and Gauges

Unlock a door at 10:09

Edition 0.86.4.5

New 0.86.4.5 field guide. Rotary Value bindings use Raw JSON in this edition. Clock hands are independent; running-clock or geared behavior is authored separately. Examples can be built in an existing project; the optional workbench is part of the PCA3D source package.

Download PDFView PDF page

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.

Source table from Unlock a door at 10:09, page 7
NodeTrue outputFalse output
clock_open equals 0Check hourEnd
hour equals 10Check minuteEnd
minute equals 9Set Variable: clock_open = 1End

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.

Page 7 of 11Permalink
Go to page