Skip to reading
Getting started with PCA3D

R10. Directed-opening helper sources

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
On this page

R10. Directed-opening helper sources

These are the supplied GDScript helpers used by the Clockmaker introduction. Keep their IDs and prepared character/asset data unchanged while matching the demo. Long lines continue at an extra indentation for print; the attached .gd files preserve exact source line breaks.

The small dial, menu and hint scripts are included too. Use the normal GDScript editor, apply each source and save. Some old demo action records say RunVisualScript even when their ID names one of these text scripts; the bundled runtime resolves that shared script call. Preserve the supplied recipe when matching the example.

menu#

Opens the built-in pause/menu screen.

Code example
func run(_context: Dictionary = {}) -> Variant:
    Runtime.system_menu.show_pause()
    return true

turn_one#

Checks numeral I against the winding sequence and advances or resets dial.

Code example
func run(_context: Dictionary = {}) -> Variant:
    var sequence: Array = [3, 1, 2]
    var step: int = int(Runtime.variables.get("dial", 0))
    if 1 != sequence[clampi(step, 0, 2)]:
        await SetVariable({"name":"dial", "value":0})
        await ShowMessage({"text":"A soft click. The winding sequence resets.", "duration":1.3})
        return false
    step += 1
    await SetVariable({"name":"dial", "value":step})
    if step == 3:
        await HideGUI({"guiId":"dial"})
        await RunVisualScript({"scriptId":"ring_bell"})
    else:
        await ShowMessage({"text":"A clean click. The next turn is ready.","duration":0.8})
    return true

turn_two#

Checks numeral II against the winding sequence and advances or resets dial.

Code example
func run(_context: Dictionary = {}) -> Variant:
    var sequence: Array = [3, 1, 2]
    var step: int = int(Runtime.variables.get("dial", 0))
    if 2 != sequence[clampi(step, 0, 2)]:
        await SetVariable({"name":"dial", "value":0})
        await ShowMessage({"text":"A soft click. The winding sequence resets.", "duration":1.3})
        return false
    step += 1
    await SetVariable({"name":"dial", "value":step})
    if step == 3:
        await HideGUI({"guiId":"dial"})
        await RunVisualScript({"scriptId":"ring_bell"})
    else:
        await ShowMessage({"text":"A clean click. The next turn is ready.","duration":0.8})
    return true
Page 177 of 184Permalink
Go to page