scottkit 0.4.0 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.yardopts +1 -1
- data/ChangeLog.md +50 -0
- data/{GPL-2 → GPL-2.txt} +0 -0
- data/README.md +100 -0
- data/Rakefile +4 -3
- data/VERSION +1 -1
- data/bin/scottkit +1 -2
- data/data/crystal/crystal.solution +4 -0
- data/data/{dan-and-matt.sck → dan-and-matt/dan-and-matt.sck} +0 -0
- data/data/{dan-and-matt.solution → dan-and-matt/dan-and-matt.solution} +0 -0
- data/data/test/Makefile +1 -1
- data/data/test/adams/Makefile +1 -1
- data/data/test/crystal.decompile +20 -20
- data/lib/scottkit/compile.rb +8 -3
- data/lib/scottkit/decompile.rb +2 -2
- data/lib/scottkit/game.rb +1 -1
- data/lib/scottkit/play.rb +7 -8
- data/manual/reference.md +904 -0
- data/notes/{Definition.saved-game → Definition-saved-game.txt} +0 -0
- data/notes/{Definition.scottfree-1.14 → Definition-scottfree-1.14.txt} +0 -0
- data/notes/{Definition → Definition.txt} +0 -0
- data/notes/adventureland-maze +2 -0
- data/test/withio_test.rb +1 -1
- metadata +39 -59
- data/.gitignore +0 -4
- data/Changes +0 -26
- data/README +0 -76
data/manual/reference.md
ADDED
@@ -0,0 +1,904 @@
|
|
1
|
+
# The ScottKit format reference manual
|
2
|
+
|
3
|
+
This is the Reference Manual for the Scott Adams Adventure toolkit's
|
4
|
+
source format. This is a part of
|
5
|
+
ScottKit, which is freely available as a Ruby gem or from
|
6
|
+
[http://github.com/MikeTaylor/scottkit](http://github.com/MikeTaylor/scottkit)
|
7
|
+
|
8
|
+
Like the software itself, this manual was written by
|
9
|
+
Mike Taylor <mike@miketaylor.org.uk>
|
10
|
+
|
11
|
+
<!-- md2toc -l 2 reference.md -->
|
12
|
+
* [Synopsis](#synopsis)
|
13
|
+
* [Description](#description)
|
14
|
+
* [Overview](#overview)
|
15
|
+
* [Rooms](#rooms)
|
16
|
+
* [`room`](#room)
|
17
|
+
* [`exit`](#exit)
|
18
|
+
* [Items](#items)
|
19
|
+
* [`item`](#item)
|
20
|
+
* [`at`](#at)
|
21
|
+
* [`nowhere`](#nowhere)
|
22
|
+
* [`called`](#called)
|
23
|
+
* [Vocabulary](#vocabulary)
|
24
|
+
* [`verbgroup`](#verbgroup)
|
25
|
+
* [`noungroup`](#noungroup)
|
26
|
+
* [Actions](#actions)
|
27
|
+
* [Game state: item locations, flags, counters, saved rooms, etc.](#game-state-item-locations-flags-counters-saved-rooms-etc)
|
28
|
+
* [`action`](#action)
|
29
|
+
* [`when`](#when)
|
30
|
+
* [`and`](#and)
|
31
|
+
* [Conditions](#conditions)
|
32
|
+
* [Results](#results)
|
33
|
+
* [`comment`](#comment)
|
34
|
+
* [`occur`](#occur)
|
35
|
+
* [Global parameters](#global-parameters)
|
36
|
+
* [`ident`](#ident)
|
37
|
+
* [`version`](#version)
|
38
|
+
* [`wordlen`](#wordlen)
|
39
|
+
* [`maxload`](#maxload)
|
40
|
+
* [`lighttime`](#lighttime)
|
41
|
+
* [`start`](#start)
|
42
|
+
* [`treasury`](#treasury)
|
43
|
+
* [`lightsource`](#lightsource)
|
44
|
+
* [See also](#see-also)
|
45
|
+
|
46
|
+
|
47
|
+
> **NOTE.**
|
48
|
+
> This manual was adapted from that of my old Perl module [Games::ScottAdams](http://www.miketaylor.org.uk/tech/advent/sac/Manual.html)
|
49
|
+
> and may not yet be fully updated to reflect the better syntax of ScottKit.
|
50
|
+
> Please let me know about any mistakes!
|
51
|
+
|
52
|
+
|
53
|
+
## Synopsis
|
54
|
+
|
55
|
+
# foo.sck - definition file for Scott Adams adventure "foo"
|
56
|
+
|
57
|
+
room swamp "dismal swamp"
|
58
|
+
exit north meadow
|
59
|
+
exit east edge
|
60
|
+
exit west grove
|
61
|
+
|
62
|
+
item mud "Evil smelling mud"
|
63
|
+
called mud
|
64
|
+
|
65
|
+
action take mud when here mud and carried bites
|
66
|
+
get mud
|
67
|
+
destroy bites
|
68
|
+
print "BOY that really hit the spot!"
|
69
|
+
|
70
|
+
|
71
|
+
## Description
|
72
|
+
|
73
|
+
The Scott Adams toolkit, `scottkit`, allows you create adventure games in
|
74
|
+
a straightforward syntax, and compiles them into the format that was
|
75
|
+
used in the classic Scott Adams adventures - and which is therefore
|
76
|
+
now understood by ScottFree and various other interpreters for
|
77
|
+
those old games.
|
78
|
+
|
79
|
+
If you're running a Linux system, there's a fair chance that you
|
80
|
+
already have such an interpreter on your system - it's probably called
|
81
|
+
`scottfree`, `ScottCurses`, `GnomeScott` or something similar.
|
82
|
+
Certainly Red Hat Linux distributions from 4.0 onwards (and maybe much
|
83
|
+
earlier) have come with Scott Adams interpreters.
|
84
|
+
|
85
|
+
This manual describes the syntax of the `sck` file which `scottkit`
|
86
|
+
compiles into Scott Adams format.
|
87
|
+
|
88
|
+
All of the examples are taken from Scott Adams' first game, the
|
89
|
+
classic _Adventureland_ - a game dripping with atmosphere and
|
90
|
+
nostalgia which I can't recommend highly enough.
|
91
|
+
|
92
|
+
|
93
|
+
## Overview
|
94
|
+
|
95
|
+
Comments may appear anywhere in a ScottKit file, and have no effect on
|
96
|
+
the compiled adventure. They are introduced by a hash character
|
97
|
+
(`#`) and extend to the end of the line. (Hashes inside strings are
|
98
|
+
literals, and do not introduce comments.)
|
99
|
+
|
100
|
+
Aside from this, line-breaks are treated like any other whitespace:
|
101
|
+
the ScottKit source file is treated as a sequence of tokens, which may
|
102
|
+
be broken across lines in whatever way best suits the author: for
|
103
|
+
example, the following sequences are all exactly equivalent:
|
104
|
+
```
|
105
|
+
room lroom "the living room" exit north lroom
|
106
|
+
|
107
|
+
room lroom "the living room"
|
108
|
+
exit north lroom
|
109
|
+
|
110
|
+
room lroom
|
111
|
+
"the living room"
|
112
|
+
exit
|
113
|
+
north
|
114
|
+
lroom
|
115
|
+
```
|
116
|
+
|
117
|
+
Each clause is introduced by a keyword, which determines what should
|
118
|
+
follow. Common keywords include `room`, `exit`, `item` and
|
119
|
+
`action`. Keywords, directions, and item and object names are all
|
120
|
+
case-sensitive.
|
121
|
+
|
122
|
+
We describe the avaialable clauses in five categories, corresponding to the
|
123
|
+
five fundamental concepts in Scott Adams adventures: the _rooms_
|
124
|
+
through which the player moves, the _items_ found in those rooms, the
|
125
|
+
_vocabulary_ with which actions are described, the _actions_ which the
|
126
|
+
player can perform, and _global parameters_.
|
127
|
+
|
128
|
+
With one exception, the order in which clauses and their associated
|
129
|
+
data appear is not significant. This yields important flexibility in
|
130
|
+
how the adventure definition file is laid out: for example, all the
|
131
|
+
rooms may appear together followed by the items, or each room may be
|
132
|
+
followed by the items which appear in it; items not initially in play
|
133
|
+
may be listed first or all, or at the end, or after the rooms in which
|
134
|
+
they will be brought into being during the game.
|
135
|
+
|
136
|
+
The one exception to this order-independence is that the order in
|
137
|
+
which actions appear is significant, because on each turn, each
|
138
|
+
possible action is considered in the order that appear. Ordering
|
139
|
+
issues are discussed in more detail in the section about the
|
140
|
+
`action` clause, but in summary: while the order of actions
|
141
|
+
relative to other actions is in some cases significant, the position
|
142
|
+
of actions relative to rooms, items and global parameters is not.
|
143
|
+
Actions may be moved ahead of and behind rooms, items and global
|
144
|
+
parameters with impunity.
|
145
|
+
|
146
|
+
|
147
|
+
## Rooms
|
148
|
+
|
149
|
+
The first fundamental concept of Scott Adams adventures is the rooms:
|
150
|
+
a connnected network of nodes between which the player can move using
|
151
|
+
the four primary compass directions plus Up and Down. With typical
|
152
|
+
topography, after moving north from one room to another, it's possible
|
153
|
+
to move south back to the first room - but the system does not enforce
|
154
|
+
this, making it possible to create complex mazes.
|
155
|
+
|
156
|
+
Each room in a ScottKit file is identified by a unique name - typically
|
157
|
+
short, and made up of alphanumerics, possibly with underscores,
|
158
|
+
although the only restriction enforced is that it may not contain any
|
159
|
+
whitespace characters (space, tab, _etc._)
|
160
|
+
|
161
|
+
After its name comes a description enclosed in double quotes (which
|
162
|
+
may extend across multiple lines) and a set of available exits, each
|
163
|
+
exit specifying its destination room.
|
164
|
+
|
165
|
+
### `room`
|
166
|
+
|
167
|
+
room chamber "root chamber under the stump"
|
168
|
+
|
169
|
+
Creates a new room whose name is the word immediately after the
|
170
|
+
`room` keyword. The string that follows is the
|
171
|
+
description of this room, which is what the player sees. (The name,
|
172
|
+
by contrast, is used only by `scottkit` itself, as an identifying tag when
|
173
|
+
the room must be referred to when defining an exit, item or action.)
|
174
|
+
|
175
|
+
For historical reasons, Scott Adams interpreters such as ScottFree
|
176
|
+
emit the string "I'm in a " (or "You're in a ", if the appropriate
|
177
|
+
option is specified) before room descriptions, so that the room
|
178
|
+
defined above would be described as
|
179
|
+
|
180
|
+
I'm in a root chamber under the stump
|
181
|
+
|
182
|
+
When this behaviour is not desired, it can be overridden by beginning
|
183
|
+
the room description with an asterisk (`*`), which is not printed but
|
184
|
+
inhibits the automatic initial string. For example, the room
|
185
|
+
definition
|
186
|
+
|
187
|
+
room ledge1 "*I'm on a narrow ledge by a chasm. Across the chasm is
|
188
|
+
the Throne-room"
|
189
|
+
|
190
|
+
is described to the player simply as
|
191
|
+
|
192
|
+
I'm on a narrow ledge by a chasm. Across the chasm is
|
193
|
+
the Throne-room
|
194
|
+
|
195
|
+
### `exit`
|
196
|
+
|
197
|
+
exit up stump
|
198
|
+
|
199
|
+
Specifies that it's possible to move from the most recently defined
|
200
|
+
room in the direction indicated by the first argument, and that doing
|
201
|
+
so takes the player to the destination indicated by the second
|
202
|
+
argument. Rooms may have any number of exits from zero to all
|
203
|
+
six.
|
204
|
+
|
205
|
+
The first argument to `exit` must be one of the directions
|
206
|
+
`north`, `south`, `east`, `west`, `up` or `down`.
|
207
|
+
The second argument must be the name of a room defined somewhere in
|
208
|
+
the ScottKit file. The destination room's definition may be either
|
209
|
+
previous or subsequent - forward references are just fine.
|
210
|
+
|
211
|
+
It's OK for an exit to lead back to the room it came from, and for
|
212
|
+
more than one exit to lead in the same direction, as in the following
|
213
|
+
example:
|
214
|
+
|
215
|
+
room forest "forest"
|
216
|
+
exit north forest
|
217
|
+
exit south forest
|
218
|
+
exit east meadow
|
219
|
+
exit west forest
|
220
|
+
|
221
|
+
|
222
|
+
## Items
|
223
|
+
|
224
|
+
The second fundamental concept of Scott Adams adventures is the items:
|
225
|
+
things that reside in a room, and in some cases can be picked up,
|
226
|
+
carried around and left in other rooms. Typically, some of the items
|
227
|
+
are "objects" like axes and keys, while others are "scenery" like
|
228
|
+
trees, signs, _etc._
|
229
|
+
|
230
|
+
As with rooms, each item in a ScottKit file is identified by a unique
|
231
|
+
name - typically a short, alphanumeric-plus-underscores name. Because
|
232
|
+
the concepts of room and item are so distinct in the Scott Adams
|
233
|
+
model, it's OK for a room and an item to share the same name. In fact
|
234
|
+
this is often the obvious thing to do - for example, consider a
|
235
|
+
situtation where the player can see a tunnel, then type `ENTER
|
236
|
+
TUNNEL` to move inside the tunnel. In this case, it's natural for
|
237
|
+
both the tunnel item and the tunnel room to have the name `tunnel`.
|
238
|
+
|
239
|
+
Apart from its name, an item is defined by its location and possibly
|
240
|
+
by a name by which it's called when getting or dropping it - see below.
|
241
|
+
|
242
|
+
### `item`
|
243
|
+
|
244
|
+
item rubies "*Pot of RUBIES*"
|
245
|
+
|
246
|
+
Creates a new item whose name is the word immediately after
|
247
|
+
`item`. The string that follows is the
|
248
|
+
description of this item, which is what the player sees. (The name is
|
249
|
+
used only as an identifying tag.)
|
250
|
+
|
251
|
+
If the item description begins with an asterisk (`*`) then it is considered
|
252
|
+
to be a treasure: it, along with any other treasures, must be
|
253
|
+
deposited in the treasury (see below) in order to score points. The
|
254
|
+
asterisk is displayed to the user; traditionally, another asterisk
|
255
|
+
appears at the end of treasure descriptions, but this is not enforced.
|
256
|
+
|
257
|
+
### `at`
|
258
|
+
|
259
|
+
at chamber
|
260
|
+
|
261
|
+
By default, each item starts the game in the last room defined before
|
262
|
+
it. This means that sequences like the following do The Right Thing:
|
263
|
+
|
264
|
+
room lake "*I'm on the shore of a lake"
|
265
|
+
item water "water"
|
266
|
+
item fish "*GOLDEN FISH*"
|
267
|
+
|
268
|
+
However, in some cases, it may be convenient to define items at some
|
269
|
+
other point in a ScottKit file - for example, some authors may prefer to
|
270
|
+
list all rooms together, then all items together. In such cases,
|
271
|
+
an item may be relocated to its correct starting room by providing
|
272
|
+
`at` followed by the name of that room:
|
273
|
+
|
274
|
+
room lake "*I'm on the shore of a lake"
|
275
|
+
room meadow "sunny meadow"
|
276
|
+
item water "water"
|
277
|
+
at lake
|
278
|
+
|
279
|
+
Items defined earlier in the ScottKit file than the first `room`
|
280
|
+
are by default not in the game when it starts (though they
|
281
|
+
may subsequently be brought into the game by DROP actions or similar -
|
282
|
+
see below.) This can of course be changed with `at`,
|
283
|
+
since here as everywhere else, forward references to rooms that have
|
284
|
+
not yet been defined are OK.
|
285
|
+
|
286
|
+
### `nowhere`
|
287
|
+
|
288
|
+
nowhere
|
289
|
+
|
290
|
+
Conversely, when defining an item that should not initially be in
|
291
|
+
play, it may be convenient to place the definition at a point in the
|
292
|
+
ScottKit file that places it in a room. In this case, `nowhere`
|
293
|
+
can be used to start it off out of play. This is
|
294
|
+
particularly useful if, for example, an item initially in play is
|
295
|
+
later to be replaced by one that is initially absent:
|
296
|
+
|
297
|
+
room stump "damp hollow stump in the swamp"
|
298
|
+
item wbottle "Water in bottle:
|
299
|
+
item ebottle "Empty bottle"
|
300
|
+
nowhere
|
301
|
+
# will come into play when water is drunk
|
302
|
+
|
303
|
+
### `called`
|
304
|
+
|
305
|
+
called lamp
|
306
|
+
|
307
|
+
Some of the items in a game - those described above as "objects"
|
308
|
+
rather than "scenery" - can be picked up and dropped. Rather than
|
309
|
+
laboriously coding these actions by hand, it's possible to have the
|
310
|
+
game automatically handle the GET and DROP actions. In order to do
|
311
|
+
this, it needs to know the word the user will use to specify the item,
|
312
|
+
and this is what `called` provides:
|
313
|
+
|
314
|
+
item lamp "Old fashioned brass lamp"
|
315
|
+
called lamp
|
316
|
+
|
317
|
+
If no `called` name is provided, then it will not be possible for
|
318
|
+
the player to pick up or drop the item unless explicit actions are
|
319
|
+
coded to make this possible.
|
320
|
+
|
321
|
+
|
322
|
+
## Vocabulary
|
323
|
+
|
324
|
+
### `verbgroup`
|
325
|
+
|
326
|
+
verbgroup GO ENT RUN WAL CLI
|
327
|
+
|
328
|
+
Establishes a set of verbs that are synonymous: for example, Go,
|
329
|
+
ENTER, RUN, WALK, CLIMB in the above example (which is taken from
|
330
|
+
_Adventureland_ where the significant word-length is 3).
|
331
|
+
|
332
|
+
### `noungroup`
|
333
|
+
|
334
|
+
noungroup lamp lantern
|
335
|
+
|
336
|
+
Establishes a set of nouns that are synonymous.
|
337
|
+
|
338
|
+
|
339
|
+
## Actions
|
340
|
+
|
341
|
+
The third fundamental concept of Scott Adams adventures is the
|
342
|
+
actions: things which the player can do, or which can happen to him,
|
343
|
+
which result in changes to the state of the world.
|
344
|
+
|
345
|
+
### Game state: item locations, flags, counters, saved rooms, etc.
|
346
|
+
|
347
|
+
State consists primarily of the items' locations, but there are also
|
348
|
+
some boolean flags, integer counters and saved room-numbers. The
|
349
|
+
flags are all set to be false at the start of the game; flag number
|
350
|
+
15 is special, and indicates whether or not it's dark. If it is, then
|
351
|
+
the player can't see without a light source. (Don't blame me for this:
|
352
|
+
it's a fact about the Scott Adams engine.)
|
353
|
+
|
354
|
+
No-one seems to know for sure how many flags were supported by the
|
355
|
+
original Scott interpreters, but by inspection, _Adventureland_ uses
|
356
|
+
flags 1 to 17, missing out flag 6 for some reason, and making only a
|
357
|
+
single reference to flag 4 (so that it's not really "used" in
|
358
|
+
any meaningful sense.)
|
359
|
+
|
360
|
+
> **Note.** The only reference to flag 4 is that it's cleared when the axe is thrown at the bear, misses and breaks the mirror (and it's never tested anywhere). Inspection of the other axe-throwing actions suggests that this is a mistake, and that Scott intended to clear flag 3. And sure enough, the behaviour is wrong if you say `at bear` twice after `throw axe`: it understands the context-less second `at bear` command instead of refusing is and saying "What?":
|
361
|
+
>
|
362
|
+
> Tell me what to do ? throw axe
|
363
|
+
> In 2 words tell me at what...like: AT TREE
|
364
|
+
>
|
365
|
+
> Tell me what to do ? at bear
|
366
|
+
> OH NO... Bear dodges... CRASH!
|
367
|
+
>
|
368
|
+
> Tell me what to do ? at bear
|
369
|
+
> OK, I threw it.
|
370
|
+
> A voice BOOOOMS out:
|
371
|
+
> please leave it alone
|
372
|
+
>
|
373
|
+
> Tell me what to do ? at bear
|
374
|
+
> What?
|
375
|
+
>
|
376
|
+
>This is not really relevant to ScottKit, but interesting trivia nevertheless. It's funny to find someone's bug twenty-two years after it was created!
|
377
|
+
|
378
|
+
Anyway, ScottFree implements 32 flags, and a comment in the source
|
379
|
+
code says that the author's never seen a game that uses a flag
|
380
|
+
numbered higher than that.
|
381
|
+
|
382
|
+
There are sixteen counters available, and sixteen slots in which room
|
383
|
+
numbers can be stored. The latter can be used to implement
|
384
|
+
sophisticated vehicles and spells which return the player to a room
|
385
|
+
that was specified earlier - for example, the `YOHO` spell in
|
386
|
+
_Sorceror of Claymorgue Castle_, which moves you first to a
|
387
|
+
destination, then back to where you first cast it (I think).
|
388
|
+
|
389
|
+
> Truth is, I'm not at all sure how the room-number slots are used; this facility is not used at all in _Adventureland_, which is the game I'm most familiar with; and looking at the reverse-engineered _Claymorgue_ actions doesn't help much.
|
390
|
+
|
391
|
+
There are four other elements of game state: the player's current
|
392
|
+
room, indications of which of the sixteen counters and room-number
|
393
|
+
slots are current (since some operations act on the "current
|
394
|
+
counter" and the "current location slot") and the number of turns
|
395
|
+
for which the light source will continue to function. You don't need
|
396
|
+
to worry about this stuff much: it's mostly taken care of behind the
|
397
|
+
scenes.
|
398
|
+
|
399
|
+
### `action`
|
400
|
+
|
401
|
+
action GET MIR
|
402
|
+
when here MIRROR and here bear
|
403
|
+
print "Bear won't let me"
|
404
|
+
|
405
|
+
Introduces a new action which occurs when the player types a command
|
406
|
+
equivalent to the one specified. Equivalent here means using the
|
407
|
+
specified verb or a synonym together with the specified noun or a
|
408
|
+
synonym - so depending on how the game is set up, `UNLOCK PORTAL`
|
409
|
+
might be equivalent to `OPEN DOOR`. The words must be specified up to,
|
410
|
+
and may optionally be specified beyond, the word-length specified by
|
411
|
+
[`wordlen`: see below](#wordlen).
|
412
|
+
|
413
|
+
`action` may optionally be followed
|
414
|
+
by a verb alone instead of a verb-noun pair as above; in this case,
|
415
|
+
the action occurs whenever the user provides any input beginning with
|
416
|
+
that word - he may provide the verb alone or with any noun.
|
417
|
+
|
418
|
+
### `when`
|
419
|
+
|
420
|
+
When this is provided, following an action, it specifies a condition
|
421
|
+
which must be satisfied in order for the results (see below) to
|
422
|
+
happen. If multiple `when` clauses are provided, then the action fires
|
423
|
+
only if _all_ of the conditions are true. There is no facility for
|
424
|
+
specifying that conditions should be OR'red together.
|
425
|
+
|
426
|
+
### `and`
|
427
|
+
|
428
|
+
This is a synonym for `when`, provided so that you can write
|
429
|
+
|
430
|
+
when here MIRROR and here bear
|
431
|
+
|
432
|
+
instead of
|
433
|
+
|
434
|
+
when here MIRROR when here bear
|
435
|
+
|
436
|
+
(In fact, you can write
|
437
|
+
|
438
|
+
and here MIRROR when here bear
|
439
|
+
|
440
|
+
if you like. It means the same.)
|
441
|
+
|
442
|
+
### Conditions
|
443
|
+
|
444
|
+
Each condition consists of a single-word opcode, followed by zero or
|
445
|
+
more parameters as required by the opcode. The following condition
|
446
|
+
opcodes are supported:
|
447
|
+
|
448
|
+
* `at` _ROOM_
|
449
|
+
--
|
450
|
+
True if the player's current room is _ROOM_, which must be the name
|
451
|
+
of a room defined somewhere in the ScottKit file.
|
452
|
+
|
453
|
+
* `carried` _ITEM_
|
454
|
+
--
|
455
|
+
True if the player is carrying _ITEM_, which must be the name
|
456
|
+
of an item defined somewhere in the ScottKit file.
|
457
|
+
|
458
|
+
* `here` _ITEM_
|
459
|
+
--
|
460
|
+
True if _ITEM_ is in the player's current room.
|
461
|
+
|
462
|
+
* `accessible` _ITEM_
|
463
|
+
--
|
464
|
+
True if _ITEM_ is either being carried by the player or in the
|
465
|
+
player's current room (i.e. if either `carried ITEM` or `here
|
466
|
+
ITEM` is true.)
|
467
|
+
|
468
|
+
* `exists` _ITEM_
|
469
|
+
--
|
470
|
+
True if _ITEM_ is in the game (i.e. is not "nowhere").
|
471
|
+
|
472
|
+
* `moved` _ITEM_
|
473
|
+
--
|
474
|
+
True if _ITEM_ has been moved from its original location. This
|
475
|
+
includes the cases where an item initially not in play has been
|
476
|
+
brought into play or vice versa, and where an item initially carried
|
477
|
+
has been dropped or vice versa. This only tests the current
|
478
|
+
situation, not _ITEM_'s history - so if _ITEM_ is moved from its
|
479
|
+
original room, then put back there, this test will return false.
|
480
|
+
|
481
|
+
* `loaded`
|
482
|
+
--
|
483
|
+
True if the player is carrying at least one item.
|
484
|
+
|
485
|
+
* `flag` _NUM_
|
486
|
+
--
|
487
|
+
True if flag number _NUM_ is set.
|
488
|
+
|
489
|
+
* `counter_eq` _NUM_
|
490
|
+
--
|
491
|
+
True if the current counter's value is _NUM_. (A different counter
|
492
|
+
may be nominated as "current" by the `select_counter` action.)
|
493
|
+
|
494
|
+
* `counter_le` _NUM_
|
495
|
+
--
|
496
|
+
True if the current counter's value is _NUM_ or less.
|
497
|
+
|
498
|
+
* `counter_ge` _NUM_
|
499
|
+
--
|
500
|
+
True if the current counter's value is _NUM_ or more.
|
501
|
+
|
502
|
+
|
503
|
+
The sense of the
|
504
|
+
`at`,
|
505
|
+
`carried`,
|
506
|
+
`here`,
|
507
|
+
`accessible`,
|
508
|
+
`exists`,
|
509
|
+
`moved`,
|
510
|
+
`loaded`,
|
511
|
+
and
|
512
|
+
`flag`
|
513
|
+
opcodes may be negated by prefixed them with an exclamation mark
|
514
|
+
(`!`). There is no direct way to test for the negation of the three
|
515
|
+
counter-related conditions.
|
516
|
+
|
517
|
+
### Results
|
518
|
+
|
519
|
+
destroy closed_door
|
520
|
+
drop open_door
|
521
|
+
msg It creaks open.
|
522
|
+
|
523
|
+
Following an `action` and its conditions, if any, comes a sequence of
|
524
|
+
result which occur if the action and its conditions are
|
525
|
+
satisfied. These are executed in sequence.
|
526
|
+
|
527
|
+
Each result action consists of a single-word opcode, followed by zero
|
528
|
+
or more parameters as required by the opcode. It is common, but not
|
529
|
+
necessary, to place each result on its own line.
|
530
|
+
|
531
|
+
The following opcodes are supported:
|
532
|
+
|
533
|
+
* `moveto` _room_
|
534
|
+
--
|
535
|
+
Moves to the specified _room_ and displays its description.
|
536
|
+
|
537
|
+
* `look`
|
538
|
+
--
|
539
|
+
Redisplays the description of the current room, the obvious exits and
|
540
|
+
any visible items. This is done automatically whenever the player
|
541
|
+
moves (with the `moveto` action), `get`s an item from the current
|
542
|
+
room, or `drop`s an item. So far as I can tell, it need only be done
|
543
|
+
explicitly when changing the value of the darkness flag.
|
544
|
+
|
545
|
+
* `look2`
|
546
|
+
--
|
547
|
+
Exactly the same as `look`, but implemented using a different
|
548
|
+
op-code in the compiled game file. (Why are both of these supported?
|
549
|
+
So that when decompiling a game that uses the latter and then
|
550
|
+
recompiling it, it remains the same.)
|
551
|
+
|
552
|
+
* `get` _item_
|
553
|
+
--
|
554
|
+
The specified _item_ is put in the player's inventory, unless too
|
555
|
+
many items are already being carried (Cf. the `superget` action).
|
556
|
+
This works even with items that can't be picked up and dropped
|
557
|
+
otherwise.
|
558
|
+
|
559
|
+
* `superget` _item_
|
560
|
+
--
|
561
|
+
The specified _item_ is put in the player's inventory, even if too
|
562
|
+
many items are already being carried. This can be used to give the
|
563
|
+
player things he doesn't want, such as the chigger bites in
|
564
|
+
_Adventureland_.
|
565
|
+
|
566
|
+
* `drop` _item_
|
567
|
+
--
|
568
|
+
The specified _item_ is put in the player's current location,
|
569
|
+
irrespective of whether it was previous carried, there, elsewhere or
|
570
|
+
nowhere (out of the game). This is the standard way to bring into the
|
571
|
+
game items which begin nowhere.
|
572
|
+
|
573
|
+
* `put` _item_ _room_
|
574
|
+
--
|
575
|
+
Puts the specified _item_ in the specified _room_.
|
576
|
+
|
577
|
+
* `put_with` _item1_ _item2_
|
578
|
+
--
|
579
|
+
Puts the first-specified item into the same location as the second.
|
580
|
+
|
581
|
+
* `swap` _item1_ _item2_
|
582
|
+
--
|
583
|
+
Exchanges the two specified items, so that each occupies the location
|
584
|
+
previously occupied by the other. This can be used to switch one
|
585
|
+
object out of the game while bringing another in, as well as for
|
586
|
+
swapping objects that are already in the game.
|
587
|
+
|
588
|
+
* `destroy` _item_
|
589
|
+
--
|
590
|
+
Removes the specified _item_ from the game, irrespective of whether
|
591
|
+
it was previously carried, in the current location, elsewhere or
|
592
|
+
already out of the game (in which case it's a no-op).
|
593
|
+
|
594
|
+
* `destroy2` _item_
|
595
|
+
--
|
596
|
+
Exactly the same as `destroy`, but implemented using a different
|
597
|
+
op-code in the compiled game file.
|
598
|
+
|
599
|
+
* `inventory`
|
600
|
+
--
|
601
|
+
Lists the items that the player carrying.
|
602
|
+
|
603
|
+
* `score`
|
604
|
+
--
|
605
|
+
Prints the current score, expressed as a mark out of 100, based on how
|
606
|
+
many treasures have been stored in the treasury location. This
|
607
|
+
causes a division-by-zero error if there are no treasures in the game -
|
608
|
+
i.e. items whose descriptions begin with an asterisk (`*`). So games
|
609
|
+
without treasures, such as Scott Adams's _Impossible Mission_, should
|
610
|
+
not provide an action with this result.
|
611
|
+
|
612
|
+
* `die`
|
613
|
+
--
|
614
|
+
Implements death by printing an "I am dead" message, clearing the
|
615
|
+
darkness flag and moving to the last defined room, which is
|
616
|
+
conventionally a "limbo" room, as in _Adventureland_'s
|
617
|
+
"Find right exit and live again!" This is not a proper, permanent
|
618
|
+
death: for that, you need the `game_over` action.
|
619
|
+
|
620
|
+
* `game_over`
|
621
|
+
--
|
622
|
+
Prints "The game is now over", waits five seconds and exits.
|
623
|
+
|
624
|
+
* `print_noun`
|
625
|
+
--
|
626
|
+
Prints the noun that the user just typed.
|
627
|
+
|
628
|
+
* `print_noun_nl`
|
629
|
+
--
|
630
|
+
Prints the noun that the user just typed, followed by a newline.
|
631
|
+
|
632
|
+
* `nl`
|
633
|
+
--
|
634
|
+
Emits a newline (i.e. moves to the beginning of the next line).
|
635
|
+
|
636
|
+
* `clear_screen`
|
637
|
+
--
|
638
|
+
Clears the screen. Who could have guessed?
|
639
|
+
|
640
|
+
* `pause`
|
641
|
+
--
|
642
|
+
Waits for two seconds. Useful before clearing the screen.
|
643
|
+
|
644
|
+
* `refill_lamp`
|
645
|
+
--
|
646
|
+
Refills the lightsource object so that it is reset to give light for
|
647
|
+
the initial number of turns, as specified by `lighttime`.
|
648
|
+
|
649
|
+
* `save_game`
|
650
|
+
--
|
651
|
+
Initiates the save-game diaglogue, allowing the player to save the
|
652
|
+
state of the game to a file. (Unfortunately, there is no corresponding
|
653
|
+
`load_game` action, so the only way to use a saved game is to restart
|
654
|
+
the interpreter, providing the name of the saved-game file on the
|
655
|
+
command-line.)
|
656
|
+
|
657
|
+
* `set_flag` _number_
|
658
|
+
--
|
659
|
+
Sets flag _number_. In general, this is useful only so that
|
660
|
+
subsequent actions and occurrences can check the value of the flag, so
|
661
|
+
there are no pre-defined meanings to the flags. The only flag with a
|
662
|
+
"built-in" meaning is number 15 (darkness).
|
663
|
+
|
664
|
+
* `clear_flag` _number_
|
665
|
+
--
|
666
|
+
Clears flag _number_.
|
667
|
+
|
668
|
+
* `set_dark`
|
669
|
+
--
|
670
|
+
Sets flag 15, which indicates darkness. Exactly equivalent to
|
671
|
+
`set_flag 15`.
|
672
|
+
|
673
|
+
* `clear_dark`
|
674
|
+
--
|
675
|
+
Clears flag 15, which indicates darkness. Exactly equivalent to
|
676
|
+
`clear_flag 15`.
|
677
|
+
|
678
|
+
* `set_0`
|
679
|
+
--
|
680
|
+
Sets flag 0. Exactly equivalent to
|
681
|
+
`set_flag 0`.
|
682
|
+
|
683
|
+
* `clear_0`
|
684
|
+
--
|
685
|
+
Clears flag 0. Exactly equivalent to
|
686
|
+
`clear_flag 0`.
|
687
|
+
|
688
|
+
* `set_counter` _number_
|
689
|
+
--
|
690
|
+
Sets the value of the currently selected counter to the specified
|
691
|
+
_value_. Negative values will not be honoured. **Do not confuse
|
692
|
+
this with the similarly named `select_counter` action!**
|
693
|
+
|
694
|
+
* `print_counter`
|
695
|
+
--
|
696
|
+
Prints the value of the currently selected counter. Apparently some
|
697
|
+
drivers can't print values greater than 99, so if you're designing
|
698
|
+
your games for maximum portability, you should avoid using numbers
|
699
|
+
higher than this.
|
700
|
+
|
701
|
+
* `decrease_counter`
|
702
|
+
--
|
703
|
+
Decreases the value of the currently selected counter by one. The
|
704
|
+
value cannot be decreased below zero. Surprisingly, there is no
|
705
|
+
corresponding `increase_counter` action, but you can use `add_counter
|
706
|
+
1`.
|
707
|
+
|
708
|
+
* `add_counter` _number_
|
709
|
+
--
|
710
|
+
Increases the value of the currently selected counter by the specified
|
711
|
+
_number_.
|
712
|
+
|
713
|
+
* `subtract_counter` _number_
|
714
|
+
--
|
715
|
+
Decreases the value of the currently selected counter by the specified
|
716
|
+
_number_.
|
717
|
+
|
718
|
+
* `select_counter` _number_
|
719
|
+
--
|
720
|
+
Chooses which of the sixteen counters is the current one. Subsequent
|
721
|
+
`decrease_counter`, `print_counter`, etc., actions will operate on
|
722
|
+
the nominated counter. (Initially, counter 0 is used.)
|
723
|
+
|
724
|
+
* `swap_loc_default`
|
725
|
+
--
|
726
|
+
Swaps the player between the current location and a backup location.
|
727
|
+
The backup location is initially undefined, so the first use of this
|
728
|
+
should be immediately followed by a `moveto` to a known room; the
|
729
|
+
next use will bring the player back where it was first used.
|
730
|
+
|
731
|
+
* `swap_loc` _number_
|
732
|
+
--
|
733
|
+
Like `swap_loc_default` but works with one of a sixteen numbered
|
734
|
+
backup locations, nominated by _number_. Swaps the current location
|
735
|
+
with backup location _number_, so that subsequently doing `swap_loc`
|
736
|
+
again with the same argument will result in returning to the original
|
737
|
+
place. This can be used to implement vehicles.
|
738
|
+
|
739
|
+
* `special` _number_
|
740
|
+
--
|
741
|
+
Performs a "special action" that is dependent on the driver. For
|
742
|
+
ScottFree, this does nothing.
|
743
|
+
|
744
|
+
* `continue`
|
745
|
+
--
|
746
|
+
**Never use this action**. It is used internally to allow a sequence of
|
747
|
+
actions that is too long to fit into a single action slot, but there
|
748
|
+
is no reason at all why you would ever explicitly use it: in fact,
|
749
|
+
this kind of low-level detail is precisely what ScottKit
|
750
|
+
is supposed to protect you from. I don't know why I'm even
|
751
|
+
mentioning it.
|
752
|
+
|
753
|
+
|
754
|
+
### `comment`
|
755
|
+
|
756
|
+
comment "need key in order to open door"
|
757
|
+
|
758
|
+
When following a set of results (i.e. at the end of an action),
|
759
|
+
this allows a comment to be associated with an action in the
|
760
|
+
Scott Adams format data file written by `scottkit`. The comment is
|
761
|
+
attached to the most recently declared action. Note that this is very
|
762
|
+
different from the usual kind of comment introduced by the hash
|
763
|
+
character (`#`) which is simply discarded by the compiler.
|
764
|
+
|
765
|
+
Why would you ever want to use `comment`? Beats me.
|
766
|
+
|
767
|
+
### `occur`
|
768
|
+
|
769
|
+
occur 10
|
770
|
+
|
771
|
+
Like `action`, the `occur` keyword introduces a sequence of zero
|
772
|
+
or more conditions which, if fulfilled, will allow some consequences
|
773
|
+
to result. The difference is that `occur` actions happen
|
774
|
+
irrespective of what command the player supplies - indeed, they happen
|
775
|
+
before anything is typed. They can be used to implement circumstances
|
776
|
+
such as falling off a ledge if in an appropriately dangerous room
|
777
|
+
while carrying a particularly heavy item.
|
778
|
+
|
779
|
+
If an optional argument is supplied then that argument is the
|
780
|
+
percentage chance of the occurrence happening when its conditions are
|
781
|
+
all satisfied; otherwise the chance is 100%.
|
782
|
+
|
783
|
+
There is one more very important difference between actions and
|
784
|
+
occurrences: before each turn, _every_ occurrence whose conditions are
|
785
|
+
all satisfied is executed. Then _at most one_ action will happen: the
|
786
|
+
first action matching the players command and whose conditions are all
|
787
|
+
satisfied.
|
788
|
+
|
789
|
+
|
790
|
+
## Global parameters
|
791
|
+
|
792
|
+
Finally, we come to the global parameters, a rag-bag of bits and
|
793
|
+
pieces which affect the game as a whole. In general, each of the
|
794
|
+
following directives should appear exactly once: it's an error for any
|
795
|
+
one of them not to appear at all, and a warning is generated if any is
|
796
|
+
used more than once.
|
797
|
+
|
798
|
+
### `ident`
|
799
|
+
|
800
|
+
ident 1
|
801
|
+
|
802
|
+
This simply specifies a number which uniquely identifies the
|
803
|
+
adventure. I have read in the `Definition` file that comes with the
|
804
|
+
ScottFree distribution that this number (and all others in the
|
805
|
+
Scott Adams file format) is "apparently 16 bit". I don't know how
|
806
|
+
this is apparent, but it's possible that some interpreters will choke
|
807
|
+
on numbers larger than 65535 (2^16-1), or maybe even 32767 (2^15-1)
|
808
|
+
if they interpret the value as signed. So you should probably pick a
|
809
|
+
number smaller than this.
|
810
|
+
|
811
|
+
Somewhere out there, there should be a register of all Scott Adams
|
812
|
+
format games, each with a unique identifier number. Unfortunately, I
|
813
|
+
don't know if there is one or where it is - please contact me if you
|
814
|
+
can point me at it (or if you want to start maintaining one!)
|
815
|
+
|
816
|
+
Also unfortunately, the uniqueness of the register is already well and
|
817
|
+
truly broken (although that doesn't mean we should break it more, of
|
818
|
+
course!)
|
819
|
+
|
820
|
+
Adams' original series of twelve adventures uses numbers 1-12
|
821
|
+
(_Adventureland_ has the coveted number 1, of course!), and the later
|
822
|
+
_Sorceror of Claymorgue Castle_ is number 13. Unfortunately,
|
823
|
+
_Return to Pirate's Island_ and _The Adventures of Buckaroo_Banzai_
|
824
|
+
are both given number 14; and the two Questprobe adventures,
|
825
|
+
_The Incredible Hulk_ and _Spiderman_ are both number two again (the
|
826
|
+
same as the original _Pirate Adventure_. What a crock. At least the
|
827
|
+
_Adventureland_ "sampler" that used to be given away for free has
|
828
|
+
its own number, 65.
|
829
|
+
|
830
|
+
To make matters worse, Brian Haworth's series of eleven _Mysterious
|
831
|
+
Adventures_ re-use the numbers 1-11. So there are no fewer than four
|
832
|
+
adventure number 2s. Ho hum.
|
833
|
+
|
834
|
+
### `version`
|
835
|
+
|
836
|
+
version 416
|
837
|
+
|
838
|
+
Specifies the version of this adventure. Looks like Adams went
|
839
|
+
through 416 design iterations before he got _Adventureland_ into a
|
840
|
+
state he was happy to release.
|
841
|
+
|
842
|
+
### `wordlen`
|
843
|
+
|
844
|
+
wordlen 3
|
845
|
+
|
846
|
+
Specifies the number of significant letters in each word known to the
|
847
|
+
game. Because this is three for _Adventureland_, all longer words
|
848
|
+
can be abbreviated to three letters - so the player can type `CLI
|
849
|
+
TRE` (or indeed `CLIMAX TREMENDOUSLY`) instead of `CLIMB TREE`.
|
850
|
+
|
851
|
+
### `maxload`
|
852
|
+
|
853
|
+
maxload 6
|
854
|
+
|
855
|
+
Specifies the maximum number of items that the player can carry at
|
856
|
+
once - if he tries to pick up something else, the interpreter issues a
|
857
|
+
suitable message.
|
858
|
+
|
859
|
+
### `lighttime`
|
860
|
+
|
861
|
+
lighttime 125
|
862
|
+
|
863
|
+
Specifies how many turns the light source is good for. Light is only
|
864
|
+
used up when the light source is in the game -- so, for example if
|
865
|
+
there's an unlit lamp in the game and a lit lamp initially not in the
|
866
|
+
game, the light time doesn't start to tick down until the lamp is lit
|
867
|
+
(i.e. the lit lamp object is brought into the game.)
|
868
|
+
|
869
|
+
### `start`
|
870
|
+
|
871
|
+
start forest
|
872
|
+
|
873
|
+
Specifies which room the player starts in.
|
874
|
+
|
875
|
+
### `treasury`
|
876
|
+
|
877
|
+
treasury stump
|
878
|
+
|
879
|
+
Specifies the room in which the player must store treasures for them to
|
880
|
+
count towards his score. Remember that treasures are, by definition,
|
881
|
+
objects whose name begins with an asterisk (`*`). The player's score
|
882
|
+
at any time is defined as the number of treasures that have been
|
883
|
+
stored in the treasury, divided by the total number of treasures,
|
884
|
+
multiplied by 100, and rounded to the nearest integer (so that it's
|
885
|
+
always in the range 0-100.)
|
886
|
+
|
887
|
+
### `lightsource`
|
888
|
+
|
889
|
+
lightsource lamp
|
890
|
+
|
891
|
+
Nominates a particular item as the light-source for the game. When
|
892
|
+
flag 15 (darkness) is set, the player can only see if either carrying
|
893
|
+
or in the presence of the lightsource object. There can be only one
|
894
|
+
lightsource in the game - if a second is nominated, it replaces the
|
895
|
+
first.
|
896
|
+
|
897
|
+
|
898
|
+
## See also
|
899
|
+
|
900
|
+
* The top-level [README](file.README.html)
|
901
|
+
* [The ScottKit tutorial](file.tutorial.html) (XXX not yet written)
|
902
|
+
* The Perl module [Games::ScottAdams](http://search.cpan.org/~mirk/Games-ScottAdams/)
|
903
|
+
|
904
|
+
|