Skip to reading
Text & Sierra-Style Adventures

A11. Controller source: lines 351-385

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

Item-on-target puzzle rules.

Code example
            Runtime.remove_inventory(item_id)
            Runtime.variables["ta_" + noun + "_room"] = Runtime.scene_id
            reply("Dropped. You can take it again here.")
        else:
            reply("You aren't carrying it.")
    elif noun == "door" and verb in ["open", "close"]:
        if not bool(Runtime.variables.ta_unlocked):
            reply("It's locked. You need the key.")
        else:
            Runtime.variables.ta_door_open = verb == "open"
            reply("The door is now " + (
                "open." if verb == "open" else "closed."))
    elif noun == "morgan" and verb == "talk":
        reply("Morgan says, 'Send the warning before the next "
            + "train arrives. Read the note beside the door.'")
    else:
        reply("That won't help. Try LOOK, or be more specific.")
Code example
func use_pair(source: String, target: String) -> void:
    if source.is_empty() or target.is_empty():
        reply("Name both things: USE KEY ON DOOR.")
    elif not present(target):
        reply("You can't see that target here.")
    elif source == "key" and target == "door":
        if not HasInventory("brass_key"):
            reply("You aren't carrying the key.")
        elif bool(Runtime.variables.ta_unlocked):
            reply("The door is already unlocked.")
        else:
            award("ta_unlocked", 2)
            reply("The key turns. The door is unlocked. Now open it.")
    elif source == "fuse" and target == "radio":
        if bool(Runtime.variables.ta_fuse_fitted):
            reply("A fuse is already fitted.")
        elif not HasInventory("fuse"):

Continue directly with the next source block.

Page 64 of 68Permalink
Go to page