Extracting room connections from zcode

The property number of the corresponding direction property is stored in the dictionary entry for words that have the dir flag set.

If you grab the ztools and run infodump with -d and -c1 on an Infocom file, you can see this dict info. Here’s an example of some output lines for zork2 version 48:

[ 384] @ $4337 north   [32 ee 1f] <adj> <dir>
[ 540] @ $477b south   [32 f2 1c] <adj> <dir>

In this output, the third byte of data after the text of the word (1f and 1c respectively) encodes the property number: 31 decimal for n_to and 28 for s_to. The comments in the reform source say that Sherlock is weird and has only 2 bytes of dict info, so this exact layout may not apply to every single Infocom story file, but the principle ought to be the same.

Another easy way to get the numbers is to look at these reform symbol files. If you grep for “exit”, you’ll find the property numbers for the various direction properties in each game.

For modern files compiled by Inform, none of this applies. Instead, there’s a compass object containing a set of direction objects, each of which has a door_dir property whose value is the property number of the direction property associated with it. So, for example, the n_obj object is in compass and n_obj.door_dir is set to n_to.

If you do want to check out Haskell, here’s a post that I made with links to some free Haskell books.