Getting Zelda Classic to use your scripts is a three-step process:
- Write the scripts
- Compile the scripts
- Assign the scripts
Scripts are compiled in ZQuest.
Compiling a Script
To compile a script, select Tools > Scripts > Compile ZScript... from the menu. This opens the Compile ZScript window.
Before you can compile, you must load your script. Click the Import button to do this; the Load ZScript window will open, allowing you to select the ZScript file to load. Browse to your script file using the controls and click OK when you've found and selected the script file.
When you return to the Compile ZScript window, you'll see something like "4325 bytes in buffer" shown. If you click the Edit button, you'll see the script you loaded (you can edit it and save it, as well). At this point, the script is loaded in ZQuest's memory, but it still hasn't been compiled.
To compile the script, click the Compile button. ZQuest will throw up a status window. If everything goes well, the last two lines should be something like:
Success! -- Press A Key --
This means the script compiled without any errors. When you press any key, the Assign Compiled Script window will open, allowing you to assign the scripts.
Tips and Tricks
Script File Extensions
By default, The Load ZScript window will only show files having a ".z" extension. Generally it is good practice to save your script files with this extension, but if you know the filename and it's location, you can save the file with any extension and ZQuest will still compile it properly.
Compiling Multiple Files
ZQuest can only manage one ZScript file. For instance, if you compile one file, assign its scripts, then compile a second file, you'll lose the compiled scripts from the first file.
One way around this is to use the import compiler directive. For example, say you have three script files that you want to keep separate. You can create a main.z script file, and use the import compiler directive to include the three files in the compilation.
Contents of main.z:
// Include standard header file. import "std.zh" // Include my custom, re-usable script files. import "myFirstFile.z" import "mySecondFile.z" import "myThirdFile.z"
Though ZQuest will only load main.z into the buffer, it will compile the contents of all three files.
Note that if you choose this approach, only the main file would need to include the std.zh header file.