Skip to reading
Text & Sierra-Style Adventures

A12. Controller source: lines 386-415

Edition 0.86.3.4

Build a complete text or graphical parser adventure with typed commands, inventory puzzles and press-to-walk controls.

Download PDFView PDF page

Room travel and the post-restore display refresh.

Code example
            reply("You aren't carrying the fuse.")
        else:
            Runtime.remove_inventory("fuse")
            Runtime.variables.ta_fuse_room = "fitted"
            award("ta_fuse_fitted", 3)
            reply("The fuse clips into place. Try TURN ON RADIO.")
    else:
        reply("Those two things don't work together.")
Code example
func travel(command: String) -> void:
    var north: bool = command in ["north", "n", "go north"]
    if north and Runtime.scene_id == "lab":
        if not bool(Runtime.variables.ta_door_open):
            reply("The cabin door is closed.")
            return
        await Runtime.change_scene("cabin", "entry")
    elif not north and Runtime.scene_id == "cabin":
        await Runtime.change_scene("lab", "entry")
    else:
        reply("There is no exit that way.")
        return
    reply(describe_room())
Code example
func on_save_loaded(_event: Dictionary = {}) -> void:
    pending_reply = false
    screen_signature = ""
    world_signature = ""
    sync_view()
    reply("Restored slot 1.")
    Runtime.state_changed()

End of the complete Adventure Controller. Apply the script and test with Play / Restart.

Page 65 of 68Permalink
Go to page