-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathBARER.ACH
335 lines (222 loc) · 7.12 KB
/
BARER.ACH
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
# BARER.ACH
#
# A bare-bones "adventure" written in Archetype for demonstration purposes.
# Many comments removed in order to show flow-of-code better.
# See BARE.ACH for complete annotation. The adventure code is identical.
#
# Author: Derek T. Jones
#
#
include "standard" # must be included for normal operation
include "utility" # "extras" for types like furniture
################################## Lexicon
Verb null
full : 'put...in'
normal : TRUE # it has a normal, or default interpretation
methods
'NORMAL' :
if main.dobj.location = main.subj then
write "But ", 'DEF' -> main.subj, " is already inside ",
'DEF' -> main.dobj, "."
else if main.dobj.open = FALSE then
write "I can't; ", 'DEF' -> main.dobj, " isn't open."
else if main.subj = main.dobj then
write "I can't put something inside itself!"
else if main.subj.stationary then
write "I can't move ", 'DEF' -> main.subj, "."
else {
main.subj.location := main.dobj; 'MOVE' -> main.subj
write "I put ", 'DEF' -> main.subj, " inside ", 'DEF' -> main.dobj, "."
}
end
################################## The Starting Room ####################
room start_room
desc : "starting room"
methods
'INITIAL' : 'START HERE' -> player # this defines the starting room
'FIRSTDESC' : write "Welcome to the demonstration adventure! What you ",
"are seeing here is the 'FIRSTDESC' method. Although in ",
"this case there is only some writing, there is no problem ",
"with putting other executable statements here as well."
'LONGDESC' : write "I'm standing in a room that has the word 'START' ",
"painted on the ceiling in neon pink. The room is fairly ",
"bare otherwise."
'south' : bedroom
'down' : if trapdoor.open then basement
end
Verb null
full : 'push'
syn : 'push down|push on'
normal : "Nothing happens."
end
object trapdoor
desc : "trapdoor"
syn : "door"
location : start_room
open : FALSE
stationary : TRUE
methods
'get' : >>It's attached to the floor.
'look' :
if open then
write "It opens downward into a yawning abyss below."
else
write "It is closed but it looks like a slight push ",
"would make it open."
'push' :
if open then
>>I already did.
else {
open := TRUE
write "I push the trapdoor and it swings downward and out, leaving ",
"a hole in the floor."
}
end
############################### The Bedroom ##########################
room bedroom
desc : "bedroom"
methods
'north' : start_room
'LONGDESC' : write "I'm standing in a tastefully decorated bedroom."
end
furniture bed
desc : "brass bed"
location : bedroom
stationary : TRUE
methods
'look' : write "It's a nice four-poster brass bed. The feet have ",
"that amusing little claw-and-ball construction."
'get' : write "It's too bulky."
'get in' : 'enter'
end
lex null full : 'open' end
lex null full : 'close' syn : 'shut' end
class openable based on furniture
open : FALSE
proximity : "in"
methods
'TRANSPARENT' : open
'look' : {
writes "It is presently "
if open then write "open." else write "closed."
}
'open' :
if open then
>>It's already open.
else {
open := TRUE
write "I opened ", 'DEF' -> self, "."
}
'close' :
if open then {
open := FALSE
write "I closed ", 'DEF' -> self, "."
}
else
write "It's already closed."
end
openable closet
desc : "closet"
location : bedroom
stationary : TRUE
methods
'get' : >>I don't think so.
end
class plural based on object
pronoun : "them"
methods
'INDEF' : "some " & desc
end
plural games desc : "board games" location : closet end
plural books desc : "books" location : closet end
object coat desc : "winter coat" location : closet end
openable chest
desc : "small chest"
location : bedroom
methods
'enter' : ABSENT
end
object necklace desc : "diamond necklace" location : chest end
openable drawers
desc : "dresser drawers"
location : bedroom
pronoun : "them"
stationary : TRUE
methods
'INDEF' : "a set of " & desc
'get' : >>Too heavy!
'enter' : ABSENT
end
############################### The Basement ########################
room basement
desc : "basement"
methods
'up' : if rope.connected then start_room
'FIRSTDESC' : {
>>AAAAAAAAAAAAAAaaaaa
>> iiii
>> eeee
>> eey
>> i
>> i
>> kes
>>
>> THUMP!
>>
write "I've landed on my rear in the bottom of a dank and musty ",
"basement. The smell of mildew is overpowering. I look ",
"up but the ceiling is very high; the open trapdoor is a ",
"tiny square of light and I cannot reach it. Oh boy."
>>
}
'LONGDESC' : write "I'm standing in the bottom of a wet basement. It is ",
"rather cold and gloomy down here."
end
lex null full : 'throw' syn : 'toss|fling' end
object rope
desc : "coil of rope with a hook on the end"
full : "coil of rope"
syn : "coil|rope|rope coil|hook"
location : basement
connected : FALSE
methods
'get' :
if connected then
write "It's already hooked onto the side of the trapdoor."
else
message --> object
'throw_up' : 'throw up'
'throw up' :
if connected then
write "I can't; it's hooked onto the side of the trapdoor."
else if player.location ~= basement then
write "Nothing happens."
else {
write "I throw the rope up in the air; the hook catches on the side ",
"of the trapdoor above and holds."
connected := TRUE
}
end
object rats
desc : "pack of rats"
location : basement
pronoun : "them"
curious : 0
methods
'INITIAL' : 'REGISTER' -> after
'get' : stop "I reach out towards them but that was a bad move; they ",
"come swarming over me and chew me to pieces."
'look' : write "They're staring at me with menacing beady red eyes."
'AFTER' :
if 'ACCESS' -> self then {
case curious +:= 1 of {
1 : write "The rats seem to be regarding me with some interest."
2 : write "The rats are moving forward slowly, overcoming their ",
"shyness."
3 : write "The rats are advancing; the floor is full of them! ",
"They're starting to hiss and snarl!"
4 : stop "The rats leap upon me and chew me to pieces. Argh!"
}
'MENTION' -> main
}
end # rats