SLAG: A Z-Machine Hint System
In a nutshell, SLAG is a Perl script that takes a command file
describing hints to be built, then converts the command file to Inform
source code. Once built and executed, the program will run the
invisiclues in the standard menu-oriented manner. The z-code binaries
are fairly lean since they reasonably do not build in Graham's parser
and all that.
John Kean's similar project which I had hoped to help on (but completely
failed to for a variety of reasons) has other intentions: convert the
Invisiclues directly from human-readable to Inform. This was a loftier
goal than I wanted to achieve, and besides I wanted a straightforward
"mark up language" to make new invisiclues-style programs.
So this SLAG hack was born.
Note that I intended for the Inform output of SLAG to be stand-alone,
but there's nothing stopping you from taking it and working it into your
own code. (Except, of course, the fact that other menuing systems might
be better.)
Features
None.
Well, there are actually a number of these:
- Ability to show an intro "splash" screen.
- Ability to nest menus.
- Ability to show just plain text (fixed or proportional fonts) in
addition to clues.
The SLAG input files, below, demonstrate pretty much everything.
"Features"
- To link from a menu to another item requires typing the title of
that item twice to identify the link.
- Syntax errors are often ignored by SLAG, leaving you to attempt to
figure out what you did wrong at the Inform-compile stage.
- To convert from the human-readable Invisiclues you download, you
must manually tidy it up into the SLAG input format. vi macros really
help out here, but it is easy to accidentally eyeball the clues if you
haven't played the game. Check John Kean's stuff if this is what you're
after.
- I'm a real novice when it comes to this low-level screen
manipulation. It works fine under Frotz for Unix, and acceptably under
xzip. I'll bet there are other interpreters that have a fit.
- Some parts of the code are still virgin.
- Clues, hints, and menu items must be typed onto a single line.
- User must remember to keep the number of menu items less than 22 or
so, or screen output will suffer on small terminals.
- Doesn't handle small screens well at all.
- Written in Perl.
- Etc.
Downloads
slag--The Perl script itself (Release 8)
The following two files are not required, but might prove interesting to
some:
Makefile--A Makefile to build the invisiclues
vimac--Some vi macros to help convert Invisiclue
files to SLAG files (contains escape characters)
I have released the SLAG source code into the public domain. So there.
If you want me to make changes or fixes, feel free to request them and
I'll accommodate you, time permitting.
I'm not doing any more .z5 files for now, but if you mail me your
requests, I'll queue them up.
Change Log
Release 8:
- Doh! Still missed some functions when unpolluting namespace in
release 7. Fixed that, and added a "generated by" comment block at the
top of the Inform output.
Release 7:
- Unpolluted namespace by prepending "SLAG_" to a bunch of internal
functions and classes that I missed last time. That should be all of
it.
Release 6:
- Fixed the output with "-s" so you only need to call one function to
get to the menus from your code (in R5 you had to add several ugly
lines.)
- Unpolluted namespace by prepending "SLAG_" to a bunch of internal
functions and classes.
Release 5:
- Added "-s" flag to strip unnecessary code from output. Useful if
you're embedding SLAG output in your own source. Prints instructions to
standard output.
- Added "-q" flag to quiet SLAG when "-s" is specified. Useful in
Makefiles when you don't want to read that stuff again and again.
- Added dummy call to Center() so that Inform won't complain about it
not being used if you don't ".CENTER" anything.
Release 4:
- Allow multiple links and hints to have the same name. In the SLAG
input add a "n:" before the string, where "n" is a number (single or
multiple digit) that uniquely identifies the hint. The number will be
stripped before printing. See the Hitchhikers input file for a demo.
Release 3:
- Added key help to the menu titlebar at John Holder's suggestion.
This reduces the menu title length (not the hint length, though) to
about 46 characters on an 80 column screen. This doesn't seem to be a
problem.
- Added the "WordStar diamond" of keys for controlling the cursor.
Release 2:
- Removed a restriction that required all link names to be unique to
the first 32 characters.
- That same change reduced z-code file sizes by about 5%-10%.
Why "SLAG"?
I was going to call it "ZHS" (Z-machine Hint System), but that seemed to
imply that my version was the Z-machine hint system. I'm not
proud enough of it to call it that, so I came up with a new impromptu
name. I rather suspect that someone else can write a better system
using the Z-Machine, so they are free to use "ZHS".
Since I had just been watching Red Dwarf, I credit Dave Lister for
inspiring me.
beej@piratehaven.org