To know how to live is my trade and my art.
— Michel de Montaigne (1533–1592), Essays
Living creatures should be given the attribute animate
so that the
library knows such an object can be talked to, given things, woken from
sleep and so on. When the player treats an animate
object
as living in this way, the library calls upon that object's life
property.
This looks like before
or after
, but only
applies to the following actions:
Attack
Kiss
WakeOther
ThrowAt
noun
at the creature.Give
noun
to the creature…Show
Ask
consult_from
and consult_words
are set up to indicate which words the object might like to think
about. (In addition, second
holds the dictionary value
for the first word which isn't 'the', but this is much
cruder.)Tell
Ask
(that
is, consult_from
and consult_words
are
set, and second
also holds the first interesting
word).Answer
orders
property hasn't handled already. Once again,
variables are set as if it were a “consult” topic.
(In addition, noun
is set to the first word, and an
attempt to read the text as a number is stored in the variable
special_number
: for instance, “computer, 143”
will cause special_number
to be set to 143.)Order
orders
property (see the next
section); action
, noun
and second
are set up as usual.If the life
rule isn't given, or
returns false
, events take their usual course.
life
rules vary dramatically in size. The coiled snake
from ‘Balances’ shows that even the tiniest life
routine can be adequate for an animal:
Object -> snake "hissing snake" with name 'hissing' 'snake', initial "Tightly coiled at the edge of the chasm is a hissing snake.", life "The snake hisses angrily!", has animate;
It's far from unknown for people in interactive fiction to be almost as simplistic as that, but in most games even relatively passive characters have some ability to speak or react. Here is the funerary priest standing in the ‘Ruins’ Shrine:
Object priest "mummified priest" with name 'mummified' 'priest', description "He is desiccated and hangs together only by will-power. Though his first language is presumably local Mayan, you have the curious instinct that he will understand your speech.", initial "Behind the slab, a mummified priest stands waiting, barely alive at best, impossibly venerable.", life [; Answer: "The priest coughs, and almost falls apart."; Ask: switch (second) { 'dictionary', 'book': if (dictionary.correct == false) "~The ~bird~ glyph... very funny.~"; "~A dictionary? Really?~"; 'glyph', 'glyphs', 'mayan', 'dialect': "~In our culture, the Priests are ever literate.~"; 'lord', 'tomb', 'shrine', 'temple': "~This is a private matter.~"; 'ruins': "~The ruins will ever defeat thieves. In the underworld, looters are tortured throughout eternity.~ A pause. ~As are archaeologists.~"; 'web', 'wormcast': "~No man can pass the Wormcast.~"; 'xibalba': if (Shrine.sw_to == Junction) "The priest shakes his bony finger."; Shrine.sw_to = Junction; "The priest extends one bony finger southwest toward the icicles, which vanish like frost as he speaks. ~Xibalb@'a, the Underworld.~"; } "~You must find your own answer.~"; Tell: "The priest has no interest in your sordid life."; Attack, Kiss: remove self; "The priest desiccates away into dust until nothing remains, not a breeze nor a bone."; ThrowAt: move noun to location; <<Attack self>>; Show, Give: if (noun == dictionary && dictionary.correct == false) { dictionary.correct = true; "The priest reads a little of the book, laughing in a hollow, whispering way. Unable to restrain his mirth, he scratches in a correction somewhere before returning the book."; } "The priest is not interested in earthly things."; ], has animate;
The Priest only stands and waits, but some characters need to move around, or to appear and reappear throughout a game, changing in their responses and what they know. This makes for a verbose object definition full of cross-references to items and places scattered across the source code. An alternative is to use different objects to represent the character at different times or places: in ‘Jigsaw’, for instance, the person called “Black” is seven different objects.
· · · · ·
Animate objects representing people with proper
names, like “Mark Antony”, need to be given the proper
attribute, and those with feminine names, such as “Cleopatra”,
need to be both female
and proper
,
though of course history would have been very different if…
Inanimate objects sometimes have proper names, too: Waldeck's
Mayan dictionary in §16 was given
proper
. See §26 for
more on naming.
· · · · ·
Some objects are not alive as such, but can still
be spoken to: microphones, tape recorders and so on. It would be
a nuisance to implement these as animate
, since
they have none of the other characteristics of life. Instead,
they can be given just the attribute talkable
, making
them responsive only to conversation. They have a life
property
to handle Answer
and so on, but it will never be asked
to deal with, for instance, Kiss
. Talkable objects can
also receive orders: see the next section.
· · · · ·
Designers often imagine animate objects as
being altogether different from things, so it's worth noting that
all the usual Inform rules apply equally well to the living. An
animate
object still has before
and
after
routines like any other, so the short list of
possible life
rules is not as restrictive as it appears.
Animate objects can also react_before
and
react_after
, and it's here that these properties really
come into their own:
react_before [; Drop: if (noun == satellite_gadget) print "~I wouldn't do that, Mr Bond,~ says Blofeld.^^"; Shoot: remove beretta; "As you draw, Blofeld snaps his fingers and a giant magnet snatches the gun from your hand. It hits the ceiling with a clang. Blofeld silkily strokes his cat."; ];
If Blofeld moves from place to place, these rules usefully move with him.
Animate objects often have possessions as part of the game design. Two examples, both from ‘The Lurking Horror’:
Recall from §12
that the child-objects of an object which isn't a container
or supporter
are outwardly visible only if the object
has the transparent
attribute. Here, the hacker should
have transparent
and the urchin not. The parser then
prevents the player from referring to whatever the urchin is hiding,
even if the player has played the game before and knows what is
in there.
•
EXERCISE 26
Arrange for a bearded psychiatrist to place the player under observation,
occasionally mumbling insights such as “Subject puts green
cone on table. Interesting.”