1
!==============================================================================!
2
! The Inform Designer's Manual (16May97) includes various references to a
3
! sample game called "Ruins", which unfortunately is not supplied with the
4
! compiler. This file attempts to knit together several of the fragments from
5
! the DM into a small but complete game, intended primarily as an example for
6
! novices of a typical way to use Inform features, and as a starting point
9
! In order to keep the game manageably small, the following references from
10
! the DM have been omitted:
11
! parrot, low mist, chasm, pumice-stone ball, glyphs, dictionary,
12
! food rations, sodium lamp, cage.
13
! Other items have been changed as necessary for simplicity and consistency.
15
! Object definitions explicitly state the name of their parent object (if
16
! appropriate), rather than using the "->" construct.
18
! Once you've played the game and (hopefully) understood how it works, you
19
! are strongly encouraged to try modifying or extending it. For instance:
20
! - add the low mist in the Forest and Square_Chamber. In the DM it smells of
21
! broth, so perhaps you should provide a source for the smell (or just
22
! change the description)?
23
! - implement the parrot, perhaps having it fly into the Forest once the plane
25
! - extend the number of rooms. There's a suggestion that you could Down from
26
! the Shrine, or perhaps you could add a dark passage leading West from the
28
! - if the passage is dark, perhaps a lamp would be useful?
29
! - if you've got a lamp, the maze in the Web becomes much less daunting
30
! (and the descriptions will need beefing up too). So perhaps it's the lamp
31
! rather than the bangle which you find on your exit from the darkened Web?
32
! - the DM is a bit unclear about the role(!) of the pumice-stone ball, but
33
! it seems to need pushing into the chasm. Maybe it blocks the gap and
34
! allows you to cross to the other side (in order to reach the bangle)?
35
! - there are a couple of daemons in the example, but no timer. How about
36
! extending the Honeycomb so that if dropped it prints a warning and starts
37
! a timer causing itself to melt unless picked up again within two turns?
39
! Of course, it isn't worth spending too long on Ruins, since it's only a
40
! somewhat dull and well-visited example. As soon as you start to feel
41
! comfortable with the way that an Inform game is constructed...
43
! ...have a go at writing one of your own. Good luck!
45
!==============================================================================!
46
! Every game needs a Story and Headline, and must include Parser and VerbLib.
47
! As DM ��7 except: Release, Serial and MAX_SCORE defined.
49
Constant Story "RUINS";
51
"^An Interactive Worked Example^
52
Copyright (c) 1995 by Graham Nelson.^
53
Revisited 1998 by Roger Firth.^";
57
Constant MAX_SCORE 100;
62
!==============================================================================!
63
! Every game needs an Initialise routine, whose primary role is to set the
64
! player's location (i.e. you) at the start of the game.
65
! As DM ��7 and 19 except: StartDaemon() call added, no TitlePage().
70
"The darkness of ages presses in on you, and you feel claustrophobic.";
71
StartDaemon(Packing_Case);
72
"^^^^^Days of searching, days of thirsty hacking through the briars of
73
the forest, but at last your patience was rewarded. A discovery!^";
76
!==============================================================================!
77
! As DM ��20. PrintRank, if defined, is called when printing the score.
80
print ", earning you the rank of ";
82
0 to 9: "humble rainforest Tourist.";
83
10 to 39: "Investigator.";
84
40 to 69: "Acquisitor.";
85
70 to 99: "Archaeologist.";
86
100: "Master Archaeologist.";
90
!==============================================================================!
91
! As DM ��11 except: daemon added, to bring the immovable crate at the start,
92
! and take it (and you) away at the end.
94
Object Packing_Case "packing case"
95
with name 'packing' 'case' 'crate' 'box' 'strongbox',
97
"Your packing case rests here, ready for you to hold any important
98
cultural finds you might make, for shipping back to civilisation.",
100
"A stout wooden crate, only slightly battered by its fall through
103
PushDir, Remove, Take:
104
"The case is too heavy to bother moving, as long as your
105
expedition is still incomplete.
106
It'll probably have to be taken out by helicopter.";
108
number 0, ! <-- used by the daemon
110
switch (++self.number) {
112
1: "^You hear the distant drone of an aeroplane.";
113
2: "^The plane is much louder, and seems to be flying very
114
low. Terrified birds rise in screeching flocks.";
115
3: move self to Forest;
116
if (location == Forest)
117
"^You involuntarily crouch as the plane flies directly
118
overhead, seemingly only inches above the treetops.
119
With a loud thump, something drops heavily to the
121
"^Even underground, the engine roar is deafening.
122
Then there's a dull thump overhead and a little dust
123
falls from the ceiling.";
125
"^The roar dies away; calm returns to the forest.";
127
5: "^A deep throbbing noise can be heard.";
128
6: "^A helicopter appears, hovering overhead.";
131
deadflag = 2; ! <-- You win!
132
"^The helicopter lowers a rope; you tie it around the
133
packing case, which is hauled up into the air,
134
then a rope ladder comes dangling down.
135
With one last look around the clearing, you climb the
136
ladder into the waiting craft.
137
Back to civilisation, and a decent pint of Brakspear's!";
140
has container open openable static;
142
!==============================================================================!
143
! As DM ��8 except: started endgame processing when all treasure has been
144
! found. Added Bangle and Ruby treasures. "Undiscovered" is useful when
145
! ensuring that treasures can't be found twice.
148
with cultural_value 10,
151
if (self in Packing_Case)
152
"Unpacking such a priceless artifact had best wait
153
until the Metropolitan Museum can do it.";
157
if (second == Packing_Case) {
158
score = score + self.cultural_value;
159
print "Safely packed away.^";
161
if (score == MAX_SCORE) {
162
StartDaemon(Packing_Case);
163
"^The case is full, and you're feeling really homesick.
164
Now, how to get out of here?";
166
rtrue; ! <-- print nothing further
169
Object Undiscovered "hidden treasure room"
170
with description "How the heck did you get here!?.";
172
Treasure Statuette "pygmy statuette" Undiscovered
173
with name 'pygmy' 'statuette' 'statue' 'mayan' 'snake' 'spirit',
175
"A menacing, almost cartoon-like statuette of a pygmy spirit
176
with an enormous snake around its neck.";
178
Treasure Bangle "silver bangle" Undiscovered
179
with name 'silver' 'bangle' 'bracelet' 'ring',
181
description "An intricately chased piece of jewellery.";
183
Treasure Ruby "blood-red ruby" Undiscovered
184
with name 'blood' 'red' 'blood-red' 'ruby' 'stone' 'jewel',
186
description "A vivid red jewel, as large as a hen's egg.";
188
Treasure Honeycomb "lump of wax" Undiscovered
189
with name 'ancient' 'honeycomb' 'old' 'honey' 'comb' 'wax' 'lump',
192
"On closer examination, the lump appears to be an old honeycomb.",
195
"Perhaps the most expensive meal of your life.
196
The honey tastes odd, perhaps because it was used to store the
197
entrails of the king buried here, but still like honey.";
201
!==============================================================================!
202
! Not in the DM as such, but useful (a) to distinguish room definitions from
203
! those of ordinary objects in the file, and (b) to provide light everywhere
204
! (unless overruled). See DM ��3.8.
209
!==============================================================================!
212
Room Forest "Dark Forest"
213
with name 'forest' 'jungle' 'clearing' 'olive' 'tree' 'trees' 'midges',
215
"In this tiny clearing, the pine-needle carpet is broken by
216
stone-cut steps leading down into the darkness.
217
Dark olive trees crowd in on all sides, the air steams with
218
warm recent rain, midges hang in the air.",
221
"The trees are spiny and you'd cut your hands to ribbons
222
trying to climb them.",
224
"The rainforest-jungle is dense, and you haven't hacked through it
225
for days to abandon your discovery now.
226
Really, you need a good few artifacts to take back to civilisation
227
before you can justify giving up the expedition.";
229
!==============================================================================!
230
! As DM ��7 and 8 except: added discovery of Statuette on picking the
233
Object Mushroom "speckled mushroom" Forest
234
with name 'speckled' 'mushroom' 'fungus' 'toadstool',
236
"A speckled mushroom grows out of the sodden earth,
239
"The mushroom is capped with blotches,
240
and you aren't at all sure it's not a toadstool.",
243
if (random(100) > 30)
244
"You nibble at one corner,
245
but the curious taste repels you.";
246
deadflag = 1; ! <-- You die!
247
"The tiniest nibble is enough.
248
It was a toadstool, and a poisoned one at that!";
252
"The mushroom drops to the ground, battered slightly.";
254
if (self has general)
255
"You pick up the slowly-disintegrating mushroom.";
257
move Statuette to location;
258
"You stoop to pick the mushroom, neatly cleaving its thin stalk.
259
As you straighten up, you notice what looks like a
260
snake in the grass.";
264
!==============================================================================!
265
! As DM ��7 and 8 except: replaced "first feet" by cobwebs.
267
Object Stone_Steps "stone-cut steps" Forest
268
with name 'stone' 'stone-cut' 'steps' 'stairs' 'cobwebs',
270
print "The cracked and worn steps descend into a dim chamber. ";
271
if (Square_Chamber has visited)
272
"The filmy cobwebs which once spanned the entrance
273
now hang in tatters.";
275
"Cobwebs form a flimsy barrier,
276
unlikely to impede your descent.";
278
door_to Square_Chamber, door_dir d_to,
279
has door open scenery;
281
!==============================================================================!
282
! As DM ��10 except: added examination of floor, word on east lintel,
283
! insect trails when mushroom bursts.
285
Room Square_Chamber "Square Chamber"
286
with name 'square' 'chamber' 'sand' 'dust' 'lintel' 'lintels' 'lintelled'
287
'east' 'south' 'doorways' 'doors' 'steps',
289
"A sunken, gloomy stone chamber, ten yards across,
290
whose floor is covered with fine sandy dust.
291
A shaft of sunlight cuts in from the steps above,
292
giving the chamber a diffuse light, but in the shadows low
293
lintelled doorways to east and south
294
lead into the deeper darkness of the Temple.",
297
if (noun == mushroom)
298
<<Insert Mushroom Sunlight>>;
301
if (Trails in location)
303
"Only your own footprints disturb the dust.";
305
Go: if (noun == e_obj) {
306
print "As you move into the eastern shadows, you seem to
307
glimpse the word SENE scratched on the lintel,
308
but before you can stop to inspect it more closely,
309
you find yourself in...^";
310
rfalse; ! <-- continue with the regular action
313
if ((noun == Mushroom) && (second == Sunlight)) {
315
move Trails to location;
316
"You drop the mushroom on the floor, in the glare of the
318
It bubbles obscenely, distends and then bursts into a
319
hundred tiny insects which run for the darkness in every
320
direction, leaving strange trails in the sandy floor.
321
No trace of fungus remain.";
328
!==============================================================================!
331
Object Sunlight "shaft of sunlight" Square_Chamber
332
with name 'shaft' 'of' 'sunlight' 'sun' 'light' 'beam' 'sunbeam' 'ray'
335
"The shaft of sunlight glimmers motes of dust in the air,
336
making it seem almost solid.",
341
"It's only an insubstantial shaft of sunlight.";
345
!==============================================================================!
346
! Not in the DM as such, but useful because employed twice. It seemed easier
347
! to have two sets of carvings rather just one plus a lot of if... tests.
351
with name 'carved' 'inscription' 'inscriptions' 'carving' 'carvings'
353
initial "Carved inscriptions crowd the walls and ceiling.",
354
has container open pluralname static;
356
!==============================================================================!
357
! As DM ��10 except: changed to include insect trails suggesting a carving,
358
! and pressable carving which reveals cavity.
360
Carved Carvings "carved inscriptions" Square_Chamber
362
print "The carvings cut deep into the rocks from which the
363
chamber is built, forming swirling sinuous patterns.";
365
print " In the middle of one wall, a small cavity can be seen.";
370
"Pressing the carved rock walls at random is unlikely
373
"The carvings are warm and smooth to the touch.";
376
Carved Other_Carvings "carved inscriptions"
378
"You stare at a group of carvings in the middle of one wall,
379
uncannily resembling the insects' trail left in the sand,
380
and feel your hand reaching out in that direction.",
383
remove Other_Carvings;
384
move Carvings to location;
385
move Cavity to Carvings;
386
"The carvings slide inwards, revealing a small cavity.";
388
"The carvings seems to shift slightly under your hand.
389
Perhaps with a little more pressure...?";
392
Object Cavity "cavity among the carvings"
393
with name 'cavity' 'hole' 'deep' 'gloomy',
395
"The cavity, a few inches across, is deep and gloomy.",
396
has container open static;
398
Object Trails "trails in the sand"
399
with name 'trail' 'trails' 'sand' 'sandy' 'pattern' 'insect' 'insects',
400
initial "Strange trails swirl on the sandy floor.",
402
if (self has general) {
404
move Other_Carvings to location;
407
"The insect trails seem to resemble one particular group of
408
carvings on the wall.";
410
has general pluralname static;
412
!==============================================================================!
413
! A Web room is implied at DM ��10, but not defined. Here, it's implemented
414
! as a simple dark maze of two rooms, once of which is home to the
415
! scuttling claws described in Example 37. The Bangle is here.
419
with name 'dark' 'darkness' 'web',
420
description "Without a light, you'll never see anything here!",
422
"Blundering around in the dark, it's impossible to tell
423
which direction is which.",
426
Maze Inner_Web "Web of Darkness"
427
with se_to Outer_Web,
429
n_to Inner_Web, s_to Inner_Web, e_to Inner_Web, w_to Inner_Web,
430
nw_to Inner_Web, sw_to Inner_Web,
431
u_to Inner_Web, d_to Inner_Web;
433
Maze Outer_Web "Web of Darkness"
434
with se_to Outer_Web,
435
ne_to Square_Chamber,
436
n_to Inner_Web, s_to Inner_Web, e_to Inner_Web, w_to Inner_Web,
437
nw_to Inner_Web, sw_to Inner_Web,
438
u_to Inner_Web, d_to Inner_Web,
440
Go: if ((noun == ne_obj) && (Bangle in Undiscovered)) {
441
move Bangle to player;
442
print "Sensing a slight draught you move in that direction,
443
stumbling over something lying on the ground in the dark.
444
Almost inadvertently you grab it before gratefully
445
emerging into the gloomy chamber.^";
446
rfalse; ! <-- continue with the regular action
450
!==============================================================================!
451
! As DM Ex.37 except: daemon runs only in the Inner_Web room.
453
Object Tiny_Claws "sound of tiny claws" thedark
454
with name 'tiny' 'claws' 'sound' 'of' 'scuttling' 'scuttle' 'things'
455
'creatures' 'insects' 'monsters',
457
initial "Somewhere, tiny claws are scuttling.",
458
description "Without a light, you'll never see anything here!",
460
Attack: "They easily avoid your flailing about in the dark.";
461
Listen: "How intelligent they sound, for mere insects.";
462
Smell: "You can smell only your own fear.";
464
"You wouldn't want to. Really.";
466
"The creatures evade you, chittering.";
468
number 0, ! <-- used by the daemon
469
each_turn [; StartDaemon(self); ],
471
if (real_location ~= Inner_Web) { ! location just has "thedark"
476
switch(++self.number) {
477
1: "^The scuttling draws a little nearer,
478
and your breathing grows load and hoarse.";
479
2: "^The perspiration of terror runs off your brow.
480
The creatures are almost here!";
481
3: "^You feel a tickling at your extremities and kick outward,
482
shaking something chitinous off.
483
Their sound alone is a menacing rasp.";
484
4: deadflag = 1; ! <-- You die!
485
"^Suddenly there is a tiny pain, of a hypodermic-sharp
487
Almost at once your limbs go into spasm, your shoulders
488
and knee-joints lock, your tongue swells...";
492
!==============================================================================!
493
! As DM ��12 except: added the moss concealing the Ruby.
495
Room Corridor "Stooped Corridor"
496
with name 'low' 'stooped' 'corridor',
498
"A low, square-cut corridor, running north to south,
500
Patches of moss emit a faint green fluorescent glow,
501
just enough that you can see your surroundings.",
506
Object Moss "mossy patches" Corridor
507
with name 'moss' 'mossy' 'patches' 'green' 'fluorescent' 'glow' 'clumps',
509
if (Ruby in Undiscovered)
510
"The moss grows in rough clumps, surprisingly thick in places.
511
Is that a hint of red hidden among all the greenery?";
512
"The moss, now somewhat raggy, grows in rough clumps.";
516
if (Ruby in Undiscovered) {
517
move Ruby to location;
518
"Something rolls from the moss onto the ground.";
521
has pluralname scenery;
523
!==============================================================================!
524
! As DM ��12. The key isn't actually defined in the DM.
526
Object Stone_Door "stone door"
527
with name 'stone' 'door' 'big' 'massive' 'yellow',
528
description "It's just a big stone door.",
529
when_closed "The passage is barred by a massive door of yellow stone.",
530
when_open "The massive yellow stone door is open.",
532
[; if (location == Corridor) return Shrine; return Corridor; ],
534
[; if (location == Corridor) return s_to; return n_to; ],
536
found_in Corridor Shrine,
537
has door lockable locked openable static;
539
Object Stone_Key "huge iron key" Cavity
540
with name 'huge' 'iron' 'key',
541
description "It must be a pretty big door to need a key like this.";
543
!==============================================================================!
544
! A Shrine room is implied at DM ��10, but not defined.
546
Room Shrine "Lofty Shrine"
547
with name 'lofty' 'shrine' 'haze' 'hazy' 'craggy' 'walls' 'quartz',
549
"For an underground chamber, the Shrine is remarkably high,
550
though its upper half is hazy and difficult to see clearly.
551
The craggy walls are polished natural rock, in which tiny
552
flecks of quartz catch the light of the flickering candle.",
555
!==============================================================================!
556
! As DM ��14 except: added processing of objects placed on the altar.
558
Object Stone_Table "slab altar" Shrine
559
with name 'stone' 'table' 'slab' 'altar' 'great',
560
initial "A great stone slab of a table dominates the Shrine.",
562
"It's big enough to lie on, though in the circumstances
563
that might prove to be a A Really Bad Idea.",
566
deadflag = 1; ! <-- You die!
567
"With astonishing speed, the horror-struck priest plucks
568
a bronze dagger from his tattered robe, and stabs you
569
in your sacrilegious heart.";
574
move Honeycomb to player;
575
"His eyes dimly agleam with gratitude, the priest takes
576
the key and conceals it among his rags.
577
Then, lifting the candle, he carefully detaches a large
578
lump of the mottled wax, and gives it to you.";
580
move Honeycomb to player;
581
"~For returning the key, that is yours to keep.~";
583
print "The priest takes ", (the) noun, " and conceals it
585
rtrue; ! <-- print nothing further
587
has enterable supporter static;
589
!==============================================================================!
590
! Not in the DM as such, but added to provide light, and as a source for
593
Object Candle "flickering candle" Stone_Table
594
with name 'flickering' 'candle' 'flame',
596
"A flickering candle at one end of the slab casts
597
grotesque shadows on the walls.",
599
"The candle is little more than a crudely moulded lump of wax.
600
Its texture is vaguely crystalline, with small fragments
604
!==============================================================================!
605
! As DM ��16 except: the priest deal in objects, not the dictionary.
607
Object Priest "mummified priest" Shrine
608
with name 'mummified' 'priest' 'old' 'ancient' 'dessicated',
610
"Behind the slab, a mummified priest stands waiting,
611
barely alive at best, impossibly venerable.",
613
"He is dessicated and hangs together only by will-power.
614
Though his first language is presumably local Mayan, you have
615
the curious instinct that he will understand your speech.",
619
'hello', 'hi', 'bye', 'goodbye', 'good-bye', 'cheerio',
620
'thanks', 'thank', 'thankyou', 'you', 'cheers', 'ta':
621
"Silently, carefully, the priest nods his head.";
623
"The priest coughs, and almost falls apart.";
626
'king', 'tomb', 'shrine', 'temple', 'altar', 'slab':
627
"~The King (life! propserity! happiness!) is buried
628
deep under this Shrine, where you will never go.~";
629
'silver', 'bangle', 'bracelet', 'ring',
630
'blood', 'red', 'blood-red', 'ruby', 'stone', 'jewel',
631
'pygmy', 'statuette', 'statue', 'mayan', 'snake', 'spirit':
632
"~That is one of my people's sacred relics.~";
633
'ancient', 'honeycomb', 'old', 'honey', 'comb', 'wax',
635
"~That is the most sacred of all my people's relics.~";
636
'huge', 'iron', 'key':
637
if (parent(Stone_Key) == nothing)
638
"~Now my people will be able to visit the Shrine.~";
639
"~That has been lost for generations.
640
My gratitude to anyone who returns it will be
643
"~You must find your own answer.~";
646
"The priest desiccates away into dust until nothing remains,
647
not a breeze or a bone.";
650
Bangle, Ruby, Statuette:
651
"~I would be grateful if you placed that before me.~";
653
"~For returning the key, that is yours to keep.~";
655
"~I would be profoundly grateful if you placed that
658
"The priest is indifferent to earthly things.";
660
"The priest has no interest in your sordid life.";
662
move noun to location;
666
Go: "~I must not leave the Shrine.~";
669
'hello', 'hi', 'bye', 'goodbye', 'good-bye', 'cheerio',
670
'thanks', 'thank', 'thankyou', 'you', 'cheers', 'ta':
671
"Silently, carefully, the priest nods his head.";
673
"~You speak in riddles~";
675
"~It is not your orders that I serve.~";
679
!==============================================================================!
680
! Every game needs to include the Grammar.
684
!==============================================================================!
685
! Added to enable you to "pick" the mushroom (as well as the usual "take",
686
! "get", "pick up", etc). See DM ��26.
688
Extend "pick" * edible -> Take;
690
!==============================================================================!