ZZT Notes
Here are some notes and code snippets for ZZT which may be useful to you, or future me, if I do anything further with the engine.
One of the unique aspects of ZZT is its capacity to be used as a medium for publishing about ZZT itself. Various company magazines, best-practice guides, and reference encyclopedias (collections of cool things you can do) were created throughout the years. However, the drawback of publishing information in this way is that you can't get to it easily without loading the world files in ZZT and actually playing them. The Museum of ZZT File Viewer helps greatly with this visibility problem, but the content is still spread across a plethora of publications.
This page will start out as a few random notes, but I hope to eventually map out the encyclopedias and attribute sources where possible.
ZZT-OOP
Set the player's health to a specific value
ZZT infamously only provides addition and subtraction to a handful of pre-defined counters. Only the Health counter can be directly set to a specific value by abusing the endgame command:
@setHealth #end :touch #endgame #give health 100 #end
Endgame normally sets the player's health to zero and triggers a Game Over state, but if you immediately give the player health afterwards, ZZT will not catch that the game should have ended, and will continue on as if nothing happened.
Display an external text file
An undocumented menu option (!-FILENAME;) will display the contents of a specified text file. These files may include additional menu links, but the text will not be executed as ZZT-OOP.
@readDoc #end :touch What do you want to read?: !-HELLO.TXT;Read HELLO.TXT! !x;Never mind. :x Okay. #end
If the file doesn't exist, nothing happens. Paths may be specified as well -- you can display Z:\AUTOEXEC.BAT when running within DOSBox, for example.
This may be useful for conserving limited memory in a large world file, or to allow blocks of text to be viewed on multiple boards without duplicating the text everywhere.