1
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
4
<title>DM4 §17: People and animals</title>
5
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
6
<link rel="stylesheet" type="text/css" href="dm4.css">
10
<a href="index.html">home</a> /
11
<a href="contents.html">contents</a> /
12
<a href="ch3.html" title="Chapter III: The Model World">chapter III</a> /
13
<a href="s16.html" title="§16: Reading matter and consultation">prev</a> /
14
<a href="s18.html" title="§18: Making conversation">next</a> /
15
<a href="dm4index.html">index</a>
18
<a id="p144" name="p144"></a>
19
<h2>§17 People and animals</h2>
21
<blockquote>To know how to live is my trade and my art.<br>
22
— Michel de Montaigne (1533–1592), <i>Essays</i></blockquote>
24
<p class="normal"><span class="atleft"><img src="dm4-144_1.jpg" alt=""></span>
25
Living creatures should be given the attribute <code>animate</code> so that the
26
library knows such an object can be talked to, given things, woken from
27
sleep and so on. When the player treats an <code>animate</code> object
28
as living in this way, the library calls upon that object's <code>life</code> property.
29
This looks like <code>before</code> or <code>after</code>, but only
30
applies to the following actions:</p>
32
<div class="inset"><dl>
33
<dt><code>Attack</code></dt><dd>The player is making hostile advances…</dd>
34
<dt><code>Kiss</code></dt><dd>… or amorous ones…</dd>
35
<dt><code>WakeOther</code></dt><dd>… or simply trying to rouse the creature from sleep.</dd>
36
<dt><code>ThrowAt</code></dt><dd>The player asked to throw <code>noun</code> at the creature.</dd>
37
<dt><code>Give</code></dt><dd>The player asked to give <code>noun</code> to the creature…</dd>
38
<dt><code>Show</code></dt><dd>… or, tantalisingly, just to show it.</dd>
39
<dt><code>Ask</code></dt><dd>The player asked about something. Just as with a
40
“consult” topic (see <a href="s16.html">§16</a>
41
above), the variables <code>consult_from</code> and <code>consult_words</code>
42
are set up to indicate which words the object might like to think
43
about. (In addition, <code>second</code> holds the dictionary value
44
for the first word which isn't <tt>'the'</tt>, but this is much
46
<dt><code>Tell</code></dt><dd>The player is trying to tell the creature about
47
something. The topic is set up just as for <code>Ask</code> (that
48
is, <code>consult_from</code> and <code>consult_words</code> are
49
set, and <code>second</code> also holds the first interesting
51
<dt><code>Answer</code></dt><dd>This can happen in two ways. One is if the player
52
types “answer some text to troll" or “say some text
53
to troll”; the other is if an order is given which the parser
54
can't sort out, such as “troll, og south", and which the
55
<code>orders</code> property hasn't handled already. Once again,
56
variables are set as if it were a “consult” topic.
57
(In addition, <code>noun</code> is set to the first word, and an
58
attempt to read the text as a number is stored in the variable
59
<code>special_number</code>: for instance, “computer, 143”
60
will cause <code>special_number</code> to be set to 143.)</dd>
61
<dt><code>Order</code></dt><dd>This catches any ‘orders’ which
62
aren't handled by the <code>orders</code> property (see the next
63
section); <code>action</code>, <code>noun</code> and <code>second</code>
64
are set up as usual.</dd>
67
<a id="p145" name="p145"></a>
68
<p class="normal">If the <code>life</code> rule isn't given, or
69
returns <code>false</code>, events take their usual course.
70
<code>life</code> rules vary dramatically in size. The coiled snake
71
from ‘Balances’ shows that even the tiniest <code>life</code>
72
routine can be adequate for an animal:</p>
74
<p class="lynxonly"></p>
76
Object -> snake "hissing snake"
77
with name 'hissing' 'snake',
78
initial "Tightly coiled at the edge of the chasm is a
80
life "The snake hisses angrily!",
84
<p class="normal">It's far from unknown for people in interactive
85
fiction to be almost as simplistic as that, but in most games even
86
relatively passive characters have some ability to speak or react.
87
Here is the funerary priest standing in the ‘Ruins’ Shrine:</p>
89
<p class="lynxonly"></p>
91
Object priest "mummified priest"
92
with name 'mummified' 'priest',
94
"He is desiccated and hangs together only by will-power.
95
Though his first language is presumably local Mayan,
96
you have the curious instinct that he will understand
98
initial "Behind the slab, a mummified priest stands waiting,
99
barely alive at best, impossibly venerable.",
101
Answer: "The priest coughs, and almost falls apart.";
102
Ask: switch (second) {
103
'dictionary', 'book':
104
if (dictionary.correct == false)
105
"~The ~bird~ glyph... very funny.~";
106
"~A dictionary? Really?~";
107
'glyph', 'glyphs', 'mayan', 'dialect':
108
"~In our culture, the Priests are ever
110
'lord', 'tomb', 'shrine', 'temple':
111
"~This is a private matter.~";
112
'ruins': "~The ruins will ever defeat thieves.
113
In the underworld, looters are tortured
114
throughout eternity.~ A pause. ~As are
115
archaeologists.~";<a id="p146" name="p146"></a>
117
"~No man can pass the Wormcast.~";
118
'xibalba': if (Shrine.sw_to == Junction)
119
"The priest shakes his bony finger.";
120
Shrine.sw_to = Junction;
121
"The priest extends one bony finger
122
southwest toward the icicles, which
123
vanish like frost as he speaks.
124
~Xibalb@'a, the Underworld.~";
126
"~You must find your own answer.~";
127
Tell: "The priest has no interest in your sordid life.";
130
"The priest desiccates away into dust until nothing
131
remains, not a breeze nor a bone.";
132
ThrowAt: move noun to location; <<Attack self>>;
134
if (noun == dictionary && dictionary.correct == false) {
135
dictionary.correct = true;
136
"The priest reads a little of the book, laughing
137
in a hollow, whispering way. Unable to restrain
138
his mirth, he scratches in a correction somewhere
139
before returning the book.";
141
"The priest is not interested in earthly things.";
146
<p class="normal">The Priest only stands and waits, but some
147
characters need to move around, or to appear and reappear throughout
148
a game, changing in their responses and what they know. This makes
149
for a verbose object definition full of cross-references to
150
items and places scattered across the source code. An
151
alternative is to use different objects to represent the character
152
at different times or places: in ‘Jigsaw’, for instance,
153
the person called “Black” is seven different objects.</p>
155
<p class="dotbreak">� � � � �</p>
157
<p class="normal">Animate objects representing people with proper
158
names, like “Mark Antony”, need to be given the <code>proper</code>
159
attribute, and those with feminine names, such as “Cleopatra”,
160
need to be both <code>female</code> and <code>proper</code>,
161
though of course history would have been very different if…
162
Inanimate objects sometimes have proper names, too: Waldeck's
163
Mayan dictionary in <a href="s16.html">§16</a> was given
164
<code>proper</code>. See <a href="s26.html">§26</a> for
167
<a id="p147" name="p147"></a>
168
<p class="dotbreak">� � � � �</p>
170
<p class="normal">Some objects are not alive as such, but can still
171
be spoken to: microphones, tape recorders and so on. It would be
172
a nuisance to implement these as <code>animate</code>, since
173
they have none of the other characteristics of life. Instead,
174
they can be given just the attribute <code>talkable</code>, making
175
them responsive only to conversation. They have a <code>life</code> property
176
to handle <code>Answer</code> and so on, but it will never be asked
177
to deal with, for instance, <code>Kiss</code>. Talkable objects can
178
also receive orders: see the next section.</p>
180
<p class="dotbreak">� � � � �</p>
182
<p class="normal">Designers often imagine animate objects as
183
being altogether different from things, so it's worth noting that
184
all the usual Inform rules apply equally well to the living. An
185
<code>animate</code> object still has <code>before</code> and
186
<code>after</code> routines like any other, so the short list of
187
possible <code>life</code> rules is not as restrictive as it appears.
188
Animate objects can also <code>react_before</code> and
189
<code>react_after</code>, and it's here that these properties really
190
come into their own:</p>
192
<p class="lynxonly"></p>
195
Drop: if (noun == satellite_gadget)
196
print "~I wouldn't do that, Mr Bond,~ says Blofeld.^^";
197
Shoot: remove beretta;
198
"As you draw, Blofeld snaps his fingers and a giant
199
magnet snatches the gun from your hand. It hits the
200
ceiling with a clang. Blofeld silkily strokes his cat.";
204
<p class="normal">If Blofeld moves from place to place, these rules
205
usefully move with him.</p>
207
<p class="indent">Animate objects often have possessions as part
208
of the game design. Two examples, both from ‘The Lurking
212
<li>an urchin with something bulging inside his jacket pocket;</li>
213
<li>a hacker who has a bunch of keys hanging off his belt.</li>
216
<p class="normal">Recall from <a href="s12.html">§12</a>
217
that the child-objects of an object which isn't a <code>container</code>
218
or <code>supporter</code> are outwardly visible only if the object
219
has the <code>transparent</code> attribute. Here, the hacker should
220
have <code>transparent</code> and the urchin not. The parser then
221
prevents the player from referring to whatever the urchin is hiding,
222
even if the player has played the game before and knows what is
225
<a id="ex26" name="ex26"></a>
226
<p class="aside"><span class="warning"><b>•</b>
227
<b><a href="sa6.html#ans26">EXERCISE 26</a></b></span><br>
228
Arrange for a bearded psychiatrist to place the player under observation,
229
occasionally mumbling insights such as “Subject puts green
230
cone on table. Interesting.”</p>
234
<a href="index.html">home</a> /
235
<a href="contents.html">contents</a> /
236
<a href="ch3.html" title="Chapter III: The Model World">chapter III</a> /
237
<a href="s16.html" title="§16: Reading matter and consultation">prev</a> /
238
<a href="s18.html" title="§18: Making conversation">next</a> /
239
<a href="dm4index.html">index</a>