Skip to reading
Text & Sierra-Style Adventures

A1. Controller source: lines 1-35

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

Vocabulary, temporary fields and the global startup hook.

Code example
extends PCAScriptBase
Code example
const NOUNS: Dictionary = {
    "key":"key", "brass key":"key", "pocket key":"key",
    "fuse":"fuse", "spare fuse":"fuse",
    "door":"door", "cabin door":"door",
    "note":"note", "notice":"note", "paper":"note",
    "radio":"radio", "transmitter":"radio", "wireless":"radio",
    "morgan":"morgan", "operator":"morgan",
    "station operator":"morgan"
}
const VERBS: Dictionary = {
    "look":"look", "examine":"look", "inspect":"look",
    "read":"read", "take":"take", "get":"take",
    "drop":"drop", "open":"open", "close":"close",
    "use":"use", "apply":"use", "talk":"talk",
    "speak":"talk", "ask":"ask"
}
var pending_reply: bool = false
var busy: bool = false
var world_signature: String = ""
var screen_signature: String = ""
var confirm_restart: bool = false
Code example
func on_global_ready(_event: Dictionary = {}) -> void:
    Runtime.variables["ta_score"] = int(Runtime.variables.ta_score)
    set_process(true)
    set_process_input(true)
Code example
func control(element_id: String) -> Control:
    return Runtime.authored_gui_manager.element_nodes.get(
        element_id) as Control
Code example
func _process(_delta: float) -> void:
    for element_id: String in ["text_command", "graph_command"]:

Continue directly with the next source block.

Page 54 of 68Permalink
Go to page