Skip to reading
Text & Sierra-Style Adventures

18. Add the Adventure Controller

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 illustrations

1. Open the GDScript Script Designer and add a new script.

2. Set its ID to adventure and its name to Adventure Controller.

3. Enable the script and mark it Global. It must remain available between commands and room changes.

4. Paste the whole of Appendix A into this one script, preserving indentation.

5. Subscribe the script to OnSaveLoaded in its event settings. Its on_save_loaded method will refresh the display after restore.

6. Apply or save the script, then check for compilation errors.

Figure 10. The controller lives in the project’s Script Designer. It does not replace or patch an engine script.

The first line extends PCAScriptBase, which gives the script its Runtime reference and adventure helpers. on_global_ready starts the small display and input routines. The send function is the common entry point for typed commands, GUI buttons and action lists.

Leave other event subscriptions off unless you deliberately add handlers for them. In particular, do not subscribe this script to every event just to make it “global.” Global lifetime and event subscriptions are different settings.

Page 21 of 68Permalink
Go to page