Skip to reading
GUI: Knobs, Dials and Gauges

Recognize the number 401

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

The supplied phone runs a ticket check after any digit. To build a combination phone, give Dialed a new visual script. This version remembers one digit at a time and clears a wrong attempt.

1. Create text variable last_digit (empty), number stage (0), and number line_open (0). Create the visual script dial_code. Set the phone’s Events → Dialed to run-visual-script with Dialed Target set to dial_code.

2. Start with If Variable: line_open equals 1. True goes to End. False goes to Read Context. Set Context Key to digit and Store in Variable to last_digit. Connect Read Context to the stage checks.

Use If Variable to ask whether stage equals 0. True goes to the first digit check. 3 False goes to a second If Variable asking whether stage equals 1. Its true output goes to the second digit check and its false output to the third.

Source table from Recognize the number 401, page 9
Digit check (If Variable)True output (Set Variable)False output
First: last_digit equals "4"Set stage to 1, then end.Set stage to 0, then end.
Second: last_digit equals "0"Set stage to 2, then end.Set stage to 0, then end.
Third: last_digit equals "1"Set line_open to 1, set stage to 0, then run the reward.Set stage to 0, then end.

In an Equals field that accepts JSON, enter the digit in double quotes. Stage and line_open use unquoted numbers. End each attempt after its chosen Set Variable node so a single dial cannot advance two stages.

Test both outcomes#

Dial 4, 1. Stage should go 0 → 1 → 0. Then dial 4, 0, 1. It should go 0 → 1 → 2 → 0, with line_open changing to 1. Another digit should do nothing. To make 041 instead, change the three text comparisons in order.

Page 9 of 11Permalink
Go to page