Those of you who have been reading this blog since 2nd March 2010 — just three days after the blog was born — might remember the fourth post I ever made here: Learning a language vs. learning a culture, on my switching from Perl to Ruby. Way back then, I wrote about “ScottKit — my first non-trivial Ruby program”. Here it is!
Back in 2010, I wrote about ScottKit as follows:
… a toolkit for messing with Scott Adams format Adventure games — simple two-word-parser interactive fiction of the kind that was popular in the 1980s and which, for me at least, has never lost its charm. […] The big gap is the documentation for the source language — it doesn’t really exist. I’ll try to fix that in the next day or so; I’ll post about ScottKit when it’s ready for the attention.
“The next day or so” turned out to take seven and a half years, but it’s finally out! If you have Ruby on your system, it should be trivial to install and run:
mike@sauropod:~$ sudo gem install scottkit Fetching: scottkit-1.0.0.gem (100%) Successfully installed scottkit-1.0.0 1 gem installed Installing ri documentation for scottkit-1.0.0... Installing RDoc documentation for scottkit-1.0.0... mike@sauropod:~$ scottkit /usr/local/bin/scottkit: No data-file specified Usage: /usr/local/bin/scottkit [options]  -c, --compile Compile instead of loading -d, --decompile Decompile instead of playing -p, --play-from-source Compile and play from source -w, --wizard Wizard mode (enabled debugging commands) -l, --load-game FILE Load a previously saved game -f, --read-file FILE Read initial commands from file -e, --echo Echo input commands to output -s, --random-seed VAL Set random seed for repeatability -b, --bug-tolerant Copy with out-of-range locations, etc. -z, --sleep-at-end Sleep for a long time after program ends -W, --no-wait Do not wait on pause actions or death -T, --show-tokens Show lexical tokens as they are read -R, --show-random Show rolls of the random dice -P, --show-parse Show results of parsing verb/noun -C, --show-conditions Show conditions being evaluated -I, --show-instructions Show instructions being executed mike@sauropod:~$
But what does it actually do? It compiles, decompiles and runs adventure games. It works with files in two formats:
- Scott Adams TRS-80 format, which has become the canonical format for distributing games built for the Scott Adams engine. You can, for example, download all Adams’s own games, and play them using the ScottFree interpreter.
- A source format of my own devising, which makes it easy to create such games.
ScottKit runs in three basic modes: it can play a Scott Adams TRS-80 format game, which is what you see in the screenshot above; it can decompile such a game into ScottKit-format source code; and it can compile source code into a playable game. As a convenient shortcut, there’s also a mode that can compile from source in-memory, and execute the game directly, so you needn’t bother with compiled files at all if you don’t want to:
mike@sauropod:/var/lib/gems/1.9.1/doc/scottkit-1.0.0$ scottkit -p /var/lib/gems/1.9.1/gems/scottkit-1.0.0/data/crystal/crystal.sck /var/lib/gems/1.9.1/gems/scottkit-1.0.0/lib/scottkit/game.rb:251: warning: assigned but unused variable - _UNUSED_dark_flag ScottKit, a Scott Adams game toolkit in Ruby. Release 1.0, (C) 2010 Mike Taylor <email@example.com> Distributed under the GNU software license I'm in a small wooden hut. Obvious exits: East. I can also see: Sign, Axe, Single match Welcome to "CRYSTAL OF CHAOS" Written by Mike Taylor, starting Monday 10th April 2001 This is a demo for the "ScottKit" adventure system Your task is to find the six crown jewels of the kingdom and store them in this hut. They are: a platinum chain, a gold crown, a silver medallion a bronze sceptre, a zinc goblet and a tin stoat. Tell me what to do ?
I conventionally use the suffix .sck (ScottKit) for the source files and .sao (Scott Adams Object-code) for the compiled games. So the four modes listed above are are used as follows:
- scottkit game.sao
- scottkit -d game.sao > game.sck
- scottkit -c game.sck > game.sao
- scottkit -p game.sck
More about ScottKit in future posts. But for now, if you’re so inclined, go and take a look at the code; and if you like games, install and run it. It comes with a bunch of games (Scott Adams’s, Brian Haworths, a small one of mine and some tutorial games) which you can play, or decompile and mess around with.