forked from shmup/wander
-
Notifications
You must be signed in to change notification settings - Fork 0
/
WanderWrld.txt
executable file
·462 lines (292 loc) · 17.6 KB
/
WanderWrld.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
WANDER .WRLD SYNTAX 4/80 WANDER .WRLD SYNTAX
SYNTAX OF THE .WRLD FILE FOR WANDER
The _._w_r_l_d file contains all the location‐specific information to
describe a particular "world".
The file consists of a series of entries separated by blank lines,
each describing one location in a particular state or in all
states.
The description of a location for a particular state consists of a
location number followed by a period and a state number, (state |
numbers start at 0), an optional short description, an optional
long description, and a series of actions possible in that state of
the location.
The description of a location for all states consists of a location
number with no state number, an optional short description, an op‐
tional long description, and a series of actions possible in all
states of the location.
LOCATION NUMBER & SHORT‐DESCRIPTION
The format of the location number & short‐description is:
(a sequence of spaces or tabs is represented by <SEP> here)
_#_l_n_u_m_b_e_r <SEP> _s_h_o_r_t_‐_d_e_s_c_r_i_p_t_i_o_n
or
_#_l_n_u_m_b_e_r_._s_n_u_m_b_e_r <SEP> _s_h_o_r_t_‐_d_e_s_c_r_i_p_t_i_o_n
_L_n_u_m_b_e_r_, (location number), is a decimal number in the range 1 to |
???, (this limit, commonly 256 or 512, is defined by MAXLOCS in the
file "wanddef.h"), preceded by ’#’.
_S_n_u_m_b_e_r_, (state number), is a decimal number in the range 0 to 127.
If the first form is used, (#lnumber), the follwing lines describe
the "base state", i.e. characteristics shared by ALL states of the
given location. If the second form is used, (#lnumber.snumber),
the following lines are only active when the specified state is ac‐
tive.
_S_h_o_r_t_‐_d_e_s_c_r_i_p_t_i_o_n is a one‐line description used to identify the
location after its full description has already been given.
Wander initially places the user in state 0 of location 1 unless |
the user specifies differently by setting the variable "CUR_LOC" in |
the _._m_i_s_c file, (see ".misc" documentation). The assignment of |
numbers to locations is entirely up to the user and they need not
be in any particular order in the _._w_r_l_d file.
‐ 1 ‐
WANDER .WRLD SYNTAX 4/80 WANDER .WRLD SYNTAX
LONG‐DESCRIPTION
_L_o_n_g_‐_d_e_s_c_r_i_p_t_i_o_n may be up to 4096 characters in length (set by
BUFSIZE in wanddef.h), and may contain any number of lines, but may
not contain a line starting with a <HT> (horizontal tab character)
or ’#’ unless the whole thing is in quotes because the first such
line indicates the beginning of the next section, (actions or a new
location/state). It’s common to enclose the entire long descrip‐
tion in quotes in which case lines may begin with a <HT> or ’#’.
If the long description is not quoted but you need spaces at the
beginning of a line, a line starting with an escaped space, "\ ",
will work.
ACTIONS
The format of actions is as follows:
<SEP>_m_a_t_c_h<SEP>_d_e_s_t<SEP>_c_o_n_t<SEP>_f_i_e_l_d<SEP>_f_i_e_l_d<SEP> . . . _m_=_t_e_x_t _m_s_g
All of these fields, with the exception of _m_a_t_c_h_, are optional. |
_M_a_t_c_h is either one or several words, often thought of as verb or
verb & object. If it is more than one word the words are separated
by escaped spaces or are enclosed in quotes. This word (or words)
is matched against the user’s input by a minimal match process
which facilitates abbreviation. _M_a_t_c_h patterns can be combined
with logical OR as _m_a_t_c_h | _m_a_t_c_h | . . .
For example,
light\ up|smoke t?cigarettes m="Eeech! These butts taste awful!"
Which is equivalent to:
"light up" t?cigarettes m="Eeech! These butts taste awful!"
smoke t?cigarettes m="Eeech! These butts taste awful!"
The verb "*" is a special case that matches anything typed by the
user.
_D_e_s_t is the number of the location to which the user will be moved
if all tests succeed and is optional. A value of 0, (or omission
of the dest field), provides no movement while a negative value
ends the game (‐1 is a verbose exit, ‐2 is a silent exit like
"quit"). A variable value like "%4%" will be replaced by the con‐
tents of of the appropriate variable, (variable 4 in this example),
evaluated at the time the user types the command.
The optional _c_o_n_t argument is either "..." or ",,,". Either form
indicates that even if this action passes all tests and is carried
out the search should continue for any further actions that match,
thus allowing multiple actions to be triggered by a single command.
The ",,," form requires that another match be found for the command
to be "satisfied" and the program will complain if none is found,
while the "..." form does not; (it is common to use ",,," for ac‐
tions that are "transparent" or hidden from the user).
‐ 2 ‐
WANDER .WRLD SYNTAX 4/80 WANDER .WRLD SYNTAX
The _m_=_t_e_x_t _m_s_g argument may contain an arbitrary text message of up
to 512 characters. This message is output as the last step in car‐ |
rying out the results of an action. "\b", "\n", "\r", and "\t" are
interpreted as backspace, return‐line‐feed, return and tab respec‐
tively. The construction "%3%" is replaced by the value of vari‐
able 3. The constructions "%INP_W1%", "%INP_W2%", ..., "%INP_W5%",
are replaced by the words used in the last input command that were
recognized by the parser. The replacement of "\" and "%" symbols
is done at output time.
The _f_i_e_l_d arguments contain test/result specifications. There may
be up to eight, _f_i_e_l_d_s in any action, (this number can be changed |
by redefining MAXFIELDS in "wanddef.h"), and there may be several
of a single type. The result fields are carried out in left‐to‐
right order.
The possible test fields are:
_t_e_s_t _f_i_e_l_d _s_u_c_c_e_e_d_s _i_f
t?obj User has obj ("tool")
t?obj@lval User has obj ("tool") and is at loc #val
t~obj User does not have obj ("tool")
t~obj@lval User does not have obj or is not at loc #val
o?obj Obj is here (either being carried or in location)
o?obj@lval Obj is at loc #val (includes carrying)
o~obj Obj is not here
o~obj@lval Obj is not at loc #val
c?val Random chance of success, (val% in this case)
s?lval.sval Location lval is in state sval
s~lval.sval Location lval is not in state sval
v?sval.bval Variable lval is equal to bval
v~sval.bval Variable lval is not equal to bval
v<sval.bval Variable lval is less than bval
v>sval.bval Variable lval is greater than bval
b?lval.sval The "been" count for loc lval == sval |
b~lval.sval The "been" count for loc lval != sval |
b<lval.sval The "been" count for loc lval < sval |
b>lval.sval The "been" count for loc lval > sval |
The possible result fields are:
_f_i_e_l_d _r_e_s_u_l_t
s=lval.sval Set state of location lval to sval
s+lval.sval Add sval to state of location lval
s‐lval.sval Subtract sval from state of location lval
v=sval.bval Set variable sval to bval
v+sval.bval Add bval to var sval (16 bits, 2’s comp)
v‐sval.bval Sub bval from var sval1 (0 if result is neg)
v*sval.bval Multiply var sval by bval (16 bits, 2’s comp)
v/sval.bval Divide var sval by bval (16 bits, 2’s comp)
o‐obj Object "obj" disappears from this loc (if here)
o‐obj@lval "obj" disappears from loc val (if there)
o+obj Object "obj" appears at this location
o+obj@lval Object "obj" appears at loc lval
t‐obj If object "obj" was being carried it disappears
t‐obj@lval If "obj" was being carried at loc lval it disappears
‐ 3 ‐
WANDER .WRLD SYNTAX 4/80 WANDER .WRLD SYNTAX
t+obj Object "obj" is now being carried
t+obj@lval "obj" is now being carried if its in loc lval
c=command "command" replaces the users input command
w=foo "foo.misc" & "foo.wrld" become the new environment
b=lval.sval Set the "been" count for loc lval to sval |
b+lval.sval Add sval to the "been" count for loc lval |
b‐lval.sval Sub sval from the "been" count for loc lval |
In the above, "sval" must be in the range 0 to 127, "lval" must be
in the range 0 to 255, (or whatever the maximum location is, check |
the "~version" command or the definition of MAXLOCS in "wand‐ |
def.h"), and "bval" must be in the range ‐32768 to 32767, Any of
these may be expressions of the form "%sval%" where sval is the
number of a variable (in the range 0 to 127). In the %sval% case
the value of the variable is substituted at the time of the action.
For instance "v=1.%3%" will save the current value of variable 3 in
variable 1. The special variables described in the main _W_a_n_d_e_r
documentation file may also be used, (CUR_LOC, MAX_CARRY, etc).
The "been to" counter for each location is an 8‐bit counter associ‐ |
ated with that location; it is zero until the location has been |
seen; after that it is incremented each time a description is given |
and then reset to 1 each time a long description is given.
EXAMPLES
A few examples may help: (lines beginning with ":" are comments and
describe the line or lines preceding them.)
#12 Spaceport Bar
: short description used for all states of location 12
You are in the Spaceport Bar on Aldebaran III, which is now deserted
except for you and the burly bartender whose eyestalks keep twitching
in your direction. A large sign hangs over the bar.
: long description for all states of location 12
read\ sign t~dictionary m="The sign is in some local dialect."
: if the user has no dictionary and asks to read the sign then this
: message is output and Wander awaits further input. (Note no dest)
read m="The sign says \"All humans MUST show papers before leaving!\""
: if the user asks to read the sign and gets this far he/she must have
: the dictionary; the message is output and Wander awaits further input.
: note the escaped quotes.
buy\ drink v>6.4 v‐6.5 m="It cost 5 credits but it’s good!"
: if the user types "buy drink" and variable 6 (which, in this case,
: represents how many credits she/he has) is greater than 4 (i.e.
: 5 or more) then the user gets a drink and loses 5 credits. Note
: that if the user types "buy" there will only be a partial match
: and Wander will ask "buy what?" If, on the other hand, the user
: types "buy peanuts" Wander will answer "You can’t buy peanuts here".
buy\ drink m="A drink costs 5 credits and you ain’t got it."
: this catches the paupers
buy o?%INP_W2% m="The %INP_W2%’s not for sale."
buy m="I’m all out of %INP_W2%, buddy."
: if the user asks to buy something else, e.g. drugs, a reasonable
: answer is given, depending on whether it’s there or not.
‐ 4 ‐
WANDER .WRLD SYNTAX 4/80 WANDER .WRLD SYNTAX
#12.0
: Header for state 0 of loc 12. Since no short description or long
: description are provided they default to the all‐state ones above.
: the following are state 1 actions
leave ‐1 m="With an amazingly graceful movement for someone\
his size, the bartender leaps\nover the bar and clubs you to death\
while pointing at the sign!"
: if the user types "leave" or "out" without first showing papers
: the bartender kills him/her and the dest of ‐1 ends the game.
: Note that the message has escaped line‐feeds in it for readability
: which are ignored by Wander. When real line‐feeds are needed,
: "\n" is used instead.
show\ papers s=12.1 m="He checks you papers and grunts happily."
: to match this the user must have typed "show papers". Wander
: prints the happy grunting bartender message and the state of
: this location (12) is changed to 1, (it was zero), all further
: input will be interpreted according to the state 1 actions below
#12.1
: because no short description is provided here the all‐state one
: (above) is used.
You are in the Spaceport Bar on Aldebaran III, which is now deserted
except for you and the burly bartender who has brought you a drink,
(on the house), after learning that you are a user of UNIX software.
: the long description for state 1 (followed by state 1 actions)
leave 13 m="The bartender wriggles a pseudopod in farewell."
: now it’s okay to leave. The user is moved to location 13.
ask o+map m=\
"The barkeep feigns ignorance, but leaves something lying on the bar."
: if the user types anything beginning with "ask", the bartender
: plays innocent but the "o+map" leaves the map to be taken.
read map o?map m="It’s too dark in here to decipher it."
: we expect the user to try this, but we want to put it off a little.
: the preceding blank line ends location 12.
#13 Outside Bar
You’re just outside a large door with a peeling sign that reads
" Ladies and Frelks welcome"
To the north an alley winds between this building and another one to
the west while to the east lies a large spaceport.
: the long description for state 0 (the only one we’ve used) of loc 13
: note the " was used to begin a line with spaces.
* t?map ... m=\
"The map in your hand glows briefly and you read the words:
Find Ignarp in Crystal City and tell him ’Axolotyl’.
Then the map turns into sooty ash."
: If the user has the map, no matter what’s been typed, this one
: is invoked. The long message is output and then Wander contimues
: to try to match the user’s input (because of the "...").
north 14 v>6.15 v‐6.127 m="As you step into the alley two\
ruffians bump into you\nand make profuse apologies."
: if the user enters the alley and has more than 15 units of credit the
: ruffians pick his pocket and the "v‐6.127" leaves him with 0 credits.
north 14
: this matches "north" when the previous one doesn’t
‐ 5 ‐
WANDER .WRLD SYNTAX 4/80 WANDER .WRLD SYNTAX
east 20
west 18
: simple movement to other locations
These few examples can’t demonstrate all the possibilities, but
they should provide a beginning understanding of the mechanisms in‐
volved.
One last example ‐‐ Let’s assume that, rather than express money
simply as Cosmic Credits, we’d like to also have a Credit Card
which you must use to establish your identity. We’d like the ruf‐
fians to lift the card itself and then use up 20 credits in the
bar... In location 13 the ruffian line would be replaced by this
one:
north v>6.30 t?card o+card@12 v‐6.20 s+12.2 m=\
"As you step into the alley two ruffians bump into you & make profuse apologies
(better check your pockets)."
: if you have more than 30 credits (v>6.30)
: and you’re carrying the credit card (t?card)
: the card is moved to loc 12 (the Bar), and left there (o+card@12),
: twenty credits are spent from your account (v‐6.20),
: the state of the bar is increased by 2, (s+12.2)
: loc/state 12.2 will contain two ruffians and an unfriendly barkeep,
: loc/state 13.2 will contain two ruffians and a friendly barkeep,
: finally, the message is printed.
After this line has been executed the user can go back to the bar
and retrieve his credit card from the now‐drunk ruffians. You
might want to allow pocket checking with something like:
check\ pockets t?watch ... m="You’re carrying a watch."
: if you have a watch mention it and continue
check\ pockets t?ring ... m="You’re carrying a ring."
: if you have a ring mention it and continue
check\ pockets t~watch t~ring ... m="You’re empty‐pocketed."
: if none of the expected items are there mention that and continue
: (note that the program has a similar built‐in response for "inventory"
check\ pockets v=6.1 m="Your account now holds one measly credit."
: being careful about singular/plural
check\ pockets m="Your account now holds %6% credits."
: if it gets here then plural is safe
BUGS
You see, I found the last bug; but when I killed it ... Well, the
funeral procession reached three times around the computer room.
‐ 6 ‐
WANDER .WRLD SYNTAX 4/80 WANDER .WRLD SYNTAX
SEE ALSO
WanderMisc.txt, Wander.txt
Copyright (c) by Peter Langston, N.Y.C.
All rights reserved.
‐ 7 ‐