3
!This game was written to demonstrate the usage of my links.h library
4
!extension for Inform. For more info about the different classes defined,
5
!please refer to links.h.
6
!This game and the library it is meant to demonstrate may be distributed
7
!freely. Having said that, if you use any of this code, I'd appreciate
8
!at least a "Thank you" in your game.
9
!Note that if you have absolutely no clue what this is all about, either
10
!go and play Andrew Plotkin's excellent game, "Spider and Web", or look at
11
!the piece of paper in this game.
12
!Also, this is a modified version of another game I wrote to demonstrate
13
!this library. However, the original had so many S&W objects, complete
14
!with spoilers, that I felt I couldn't release it publicly.
16
constant story "Links and Links";
17
constant headline "An Interactive Test program for the links.h Inform Library^
18
Library and game written by Jayson Smith^
19
Original idea for library inspired by ~Spider and Web~, by Andrew Plotkin^";
26
room room1 "The first room"
28
"This is the first in a series of rather nondescript rooms. There's an
31
object box "large box" room1
32
with name "box" "large" "big",
33
with describe "There's a large box on the floor here.",
35
print "It's just a large box, made of some plastic material.^";
36
if (self hasnt open) "It's closed.";
38
if (children(self)==0) " but empty.";
39
print ", and it contains ";
40
writelistfrom(child(self),fullinv_bit+english_bit+recurse_bit);
43
has container openable open;
44
room room2 "The second room"
45
with description "This is the second in a series of rather nondescript rooms.
46
There are exits to the north and south.",
49
room room3 "The third room"
50
with description "Wow. Yet another nondescript room!^
51
There are exits to the north and south, but to tell you the truth, neither
52
of them look particularly inviting.",
55
room room4 "The forth room"
56
with description "Guess what? Yet another very nondescript room!^
57
But this time, you've reached the other end. There's only an exit to the
60
actuator button "button" box
61
with name "button" "pushbutton",
63
"It's a small button which can be used to activate something.^",
70
device beeper "beeper" box
73
"It is a small box which beeps when activated.^",
76
if (testscope(beeper)) "The beeper beeps a few times then stops.";
79
if (testscope(beeper)) "The beeper starts beeping.";
80
else "You hear a beeping from somewhere nearby.";
85
switch toggle "toggle switch" box
86
with name "toggle" "switch" "flipswitch",
88
with description "It is a switch used to activate or deactivate something.";
89
device flashlight "flashlight" box
90
with name "flashlight" "flash" "light" "lamp",
91
with description "It is just a small light source. It looks like it
92
could light a room enough to see by.",
94
print "The flashlight starts to glow.^";
99
print "The flashlight stops glowing.^";
103
with brief "The flashlight glows briefly then goes dark.",
105
remote rcontrol "remote control" box
106
with name "remote" "control" "controller",
108
"It's a small square with three buttons, marked ~on~, ~off~ and ~brief~.
109
It doesn't have a link, but works via a remote receiver module.^",
110
with baseunit recmod,
112
self.baseunit.turnon();
115
self.baseunit.turnoff();
118
self.baseunit.brief();
121
object onbutton "on button on the remote control" rcontrol
122
with name "on" "onbutton",
123
with description "It is one of three buttons on the remote control unit.",
126
if (rcontrol has on) "Nothing happens.";
128
print "The remote control beeps once.^";
132
object offbutton "off button on the remote control" rcontrol
133
with name "off" "offbutton",
134
with description "It is one of three buttons on the remote control unit.",
137
if (rcontrol hasnt on) "Nothing happens.";
139
print "The remote control beeps once.^";
143
object briefbutton "brief button on the remote control" rcontrol
144
with name "brief" "briefbutton",
145
with description "It is one of three buttons on the remote control unit.",
148
if (rcontrol has on) "Nothing happens.";
149
print "The remote control beeps once.";
153
actuator recmod "remote receiver module" box
154
with name "remote" "receiver" "module",
156
"It's a small box with no controls. It is obviously a remote control
157
receiver module, meant to be used in conjunction with a remote control.^",
159
device bomb "bomb" box
160
with name "bomb" "small",
161
with description "This bomb is rather small, but it's very powerful!",
163
if (testscope(self)) {
165
The bomb explodes so near you that you are killed from all the noise
166
and junk flying all about, not to mention the explosion!^";
170
print "You hear what sounds like a large explosion from somewhere nearby.
171
Oh no! It's your bomb, and it's even more powerful than you'd imagined!
172
The explosion is soon over, but the building can't hold up to it, and
177
"Once this bomb is turned on, the game ends. So it can't ever be
186
print "Well, finally, here you are, in the building of Links and Links.^
187
You've waited for all your life to come here, and now you have all these
188
toys to play with! So play with them!^";
189
print "Note: There is no objective to this game except to have fun! In
190
particular, there is no way to win.^";
192
object paper "piece of paper" room1
193
with name "piece" "paper" "sign" "note",
195
"You almost miss a piece of paper on the floor.",
197
"Welcome to ~Links and Links~! This is an example game meant to demonstrate
198
my links.h library file. If you have absolutely no idea what this is all
199
about, go play Andrew Plotkin's excellent game, ~Spider and Web~. If you've
200
already played it, what you do here should be obvious. For those of you
201
who have not played S&W, here's a brief summary:^
202
There are several objects in the box. Those with a plus link are actuators
203
and are meant to be used to activate devices. Devices have a minus link.^
204
To link two things together, just ~link xxx to yyy~. To unlink, just
206
Please substitute real object names for xxx and yyy in the above examples.^
207
you can find out which objects have plus and minus links by examining them.^
208
Note that you can't link two objects with plus links, or two objects with
209
minus links, together. In actuality, there's no reason you'd ever want
210
to do this, so it's not a problem.^