Appendix A. Install the complete controller
The following pages contain the complete Adventure Controller in order. Paste every code block into one GDScript record with ID adventure. Do not paste page headings, line-range captions or the explanatory paragraphs.
Indentation is part of GDScript. Preserve the four spaces shown inside each function or branch. If copying from a PDF changes quotation marks, indentation or a backslash, correct it in the Script Designer before running the game.
| Before Play | Required setup |
|---|---|
| Script | Enabled and Global; event subscription OnSaveLoaded. |
| Scenes | lab and cabin; both have entry spawns. |
| Inventory | brass_key and fuse, initially not carried. |
| Variables | All ta_ variables from lessons 16-17. |
| GUI IDs | text_screen, graph_hud, reply_card. |
| Control IDs | story_transcript, text_command, graph_command. |
| Reply Label | Text is $$ta_reply. |
| Graphical input | Arrow Keys + Sierra AGI movement; native Space focus off. |
RESTORE uses a deferred runtime call because loading replaces script instances. Keep the OnSaveLoaded handler at the end of the script. The variables hold persistent story data; pending_reply, busy and display signatures are temporary control state.
