Zed Lopez

I ♥ Perl, the Command Line, and Infocom Text Adventures

I decided to dust off (literally, it turned out) my Classic Text Adventure Masterpieces CD and install the games. I installed Malyon, the zcode interpreter for Emacs. But it checks to see that the files end .z3, .z5, or .z8, indicating its zcode version, and all the zcode files from the CD ended .dat. And some of them were version 4, so it would be useful to have them marked correctly so I know which ones Malyon won’t handle. The second byte of the file is the version number (and the first byte is guaranteed to be 0), and I wanted to skip the .dat files in ‘save’ directories, so:

find . -name ‘*.dat’|fgrep -v ‘/save/’|xargs perl -e ‘for (@ARGV) { $old=$; read(FH, $buf, 2); $z=unpack “c”, $buf; s/dat$/z$z/; rename $old, $}’

Next thing you know, I’m west of a white house.

Short shameful confession: the first Zork is the only Infocom game I ever finished (though I came really close with Hitchhiker’s.) So I figure I have my next several years of gaming lined up.