~ubuntu-branches/ubuntu/vivid/inform/vivid

« back to all changes in this revision

Viewing changes to inform-6.31.1/include/links.inf

  • Committer: Bazaar Package Importer
  • Author(s): Jan Christoph Nordholz
  • Date: 2008-05-26 22:09:44 UTC
  • mfrom: (2.1.1 lenny)
  • Revision ID: james.westby@ubuntu.com-20080526220944-ba7phz0d1k4vo7wx
Tags: 6.31.1+dfsg-1
* Remove a considerable number of files from the package
  due to unacceptable licensing terms.
* Repair library symlinks.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
!Links and Links
 
2
!By Jayson Smith
 
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.
 
15
 
 
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^";
 
20
include "parser";
 
21
include "verblib";
 
22
include "links";
 
23
include "grammar";
 
24
class room
 
25
has light;
 
26
room room1 "The first room"
 
27
with description
 
28
"This is the first in a series of rather nondescript rooms.  There's an
 
29
exit to the north.",
 
30
n_to room2;
 
31
object box "large box" room1
 
32
with name "box" "large" "big",
 
33
with describe "There's a large box on the floor here.",
 
34
with description [;
 
35
print "It's just a large box, made of some plastic material.^";
 
36
if (self hasnt open) "It's closed.";
 
37
print "It's open";
 
38
if (children(self)==0) " but empty.";
 
39
print ", and it contains ";
 
40
writelistfrom(child(self),fullinv_bit+english_bit+recurse_bit);
 
41
print ".^";
 
42
],
 
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.",
 
47
n_to room3,
 
48
s_to room1;
 
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.",
 
53
s_to room2,
 
54
n_to room4;
 
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
 
58
south!",
 
59
s_to room3;
 
60
actuator button "button" box
 
61
with name "button" "pushbutton",
 
62
with description
 
63
"It's a small button which can be used to activate something.^",
 
64
with before [;
 
65
push:
 
66
self.brief();
 
67
rtrue;
 
68
],
 
69
has pluslink;
 
70
device beeper "beeper" box
 
71
with name "beeper",
 
72
with description
 
73
"It is a small box which beeps when activated.^",
 
74
has minuslink,
 
75
with brief [;
 
76
if (testscope(beeper)) "The beeper beeps a few times then stops.";
 
77
],
 
78
with turnon [;
 
79
if (testscope(beeper)) "The beeper starts beeping.";
 
80
else "You hear a beeping from somewhere nearby.";
 
81
],
 
82
with turnoff [;
 
83
"The beeping stops.";
 
84
];
 
85
switch toggle "toggle switch" box
 
86
with name "toggle" "switch" "flipswitch",
 
87
has pluslink,
 
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.",
 
93
with turnon [;
 
94
print "The flashlight starts to glow.^";
 
95
give self light;
 
96
rtrue;
 
97
],
 
98
with turnoff [;
 
99
print "The flashlight stops glowing.^";
 
100
give self ~light;
 
101
rtrue;
 
102
],
 
103
with brief "The flashlight glows briefly then goes dark.",
 
104
has minuslink;
 
105
remote rcontrol "remote control" box
 
106
with name "remote" "control" "controller",
 
107
with description
 
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,
 
111
with turnon [;
 
112
self.baseunit.turnon();
 
113
],
 
114
with turnoff [;
 
115
self.baseunit.turnoff();
 
116
],
 
117
with brief [;
 
118
self.baseunit.brief();
 
119
],
 
120
has transparent;
 
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.",
 
124
with before [;
 
125
push:
 
126
if (rcontrol has on) "Nothing happens.";
 
127
give rcontrol on;
 
128
print "The remote control beeps once.^";
 
129
rcontrol.turnon();
 
130
rtrue;
 
131
];
 
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.",
 
135
with before [;
 
136
push:
 
137
if (rcontrol hasnt on) "Nothing happens.";
 
138
give rcontrol ~on;
 
139
print "The remote control beeps once.^";
 
140
rcontrol.turnoff();
 
141
rtrue;
 
142
];
 
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.",
 
146
with before [;
 
147
push: 
 
148
if (rcontrol has on) "Nothing happens.";
 
149
print "The remote control beeps once.";
 
150
rcontrol.brief();
 
151
rtrue;
 
152
];
 
153
actuator recmod "remote receiver module" box
 
154
with name "remote" "receiver" "module",
 
155
with description
 
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.^",
 
158
has pluslink;
 
159
device bomb "bomb" box
 
160
with name "bomb" "small",
 
161
with description "This bomb is rather small, but it's very powerful!",
 
162
with brief [;
 
163
if (testscope(self)) {
 
164
print "BOOM!^
 
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!^";
 
167
deadflag=1;
 
168
rtrue;
 
169
};
 
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
 
173
soon crumples.^";
 
174
deadflag=1;
 
175
],
 
176
with turnoff [;
 
177
"Once this bomb is turned on, the game ends.  So it can't ever be
 
178
turned off!  [bug]";
 
179
],
 
180
with turnon [;
 
181
self.brief();
 
182
],
 
183
has minuslink;
 
184
[initialise;
 
185
location=room1;
 
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.^";
 
191
];
 
192
object paper "piece of paper" room1
 
193
with name "piece" "paper" "sign" "note",
 
194
with describe
 
195
"You almost miss a piece of paper on the floor.",
 
196
with description
 
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
 
205
~unlink xxx~^
 
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.^
 
211
Have fun!^";
 
212