1
<HTML><HEAD><TITLE>Section 13: Switchable objects</TITLE></HEAD>
2
<BODY BGCOLOR="#FFFFFF">
5
<TR><TD Valign="top"><A HREF="contents.html">Contents</A><BR><A HREF="section12.html">Back</A><BR><A HREF="section14.html">Forward</A><TD bgcolor="#F5DEB3"><BLOCKQUOTE><H3>13. Switchable objects</H3></BLOCKQUOTE><TR><TD><TD>
9
Steven: 'Well, what does this do?'<SAMP> </SAMP> Doctor: 'That is the dematerialising
10
control. And that over yonder is the horizontal hold. Up there is the
11
scanner, these are the doors, that is a chair with a panda on it. Sheer
12
poetry, dear boy. Now please stop bothering me.'
14
<I> The Time Meddler</I>, <I> Dr Who</I>, serial <B> 17</B> (<B>1965</B>)</BLOCKQUOTE>
20
Objects can also be <TT>switchable</TT>. This means they can be turned off or
21
on, as if they had some kind of switch on them. The object has the
22
attribute <TT>on</TT> if it's on. For
25
Object searchlight "Gotham City searchlight" skyscraper
26
with name "search" "light" "template", article "the",
27
description "It has some kind of template on it.",
28
when_on "The old city searchlight shines out a bat against
29
the feather-clouds of the darkening sky.",
30
when_off "The old city searchlight, neglected but still
31
functional, sits here."
32
has switchable static;
35
Something more portable would come in handy for the
36
explorer of 'Ruins', who would hardly have embarked on his expedition
37
without a decent light source...
39
Object sodium_lamp "sodium lamp"
40
with name "sodium" "lamp" "heavy",
43
"^The sodium lamp squats heavily on the ground.";
44
"^The sodium lamp squats on the ground, burning away.";
48
[; Examine: print "It is a heavy-duty archaeologist's lamp, ";
49
if (self hasnt on) "currently off.";
50
if (self.battery_power < 10) "glowing a dim yellow.";
51
"blazing with brilliant yellow light.";
52
Burn: <<SwitchOn self>>;
54
if (self.battery_power <= 0)
55
"Unfortunately, the battery seems to be dead.";
56
if (parent(self) hasnt supporter && self notin location)
57
"The lamp must be securely placed before being lit.";
60
"The bulb's too delicate and the metal frame's too
61
hot to lift the lamp while it's switched on.";
64
[; SwitchOn: give self light;
65
SwitchOff: give self ~light;
70
The 'Ruins' lamp will eventually be a little more complicated, with a
71
daemon to make the battery power run down and to extinguish the lamp
72
when it runs out; and it will be pushable from place to place, making it
73
not quite as useless as the player will hopefully think at first.
76
<P><TR><TD Valign="top"><IMG SRC="icons/dbend.gif" ALT="/\"><TD bgcolor="#EEEEEE"><SMALL> A point to note is that this time the <TT>when_on</TT> and <TT>when_off</TT>
77
properties haven't been used to describe the lamp when it's on the ground:
78
this is because once an object has been held by the player, it's normally
79
given only a perfunctory mention in room descriptions ("You can also see a
80
sodium lamp and a grape here.''). But the <TT>describe</TT> property has priority
81
over the whole business of how objects are described in room
82
descriptions. When it returns true, as above, the usual description process
83
does nothing further. For much more on room descriptions, see <A HREF="section22.html">Section 22</A>.
87
<P><TR><TD Valign="top"><IMG SRC="icons/refs.gif" ALT="*"><TD bgcolor="#EEEEEE"><B>REFERENCES:</B><BR><SMALL> The original switchable object was the brass lamp from 'Advent'
88
(which also provides verbs "on'' and "off'' to switch it). (The other
89
example games are generally pre-electric in setting.)
95
<HR><A HREF="contents.html">Contents</A> / <A HREF="section12.html">Back</A> / <A HREF="section14.html">Forward</A> <BR>
96
<A HREF="chapter1.html">Chapter I</A> / <A HREF="chapter2.html">Chapter II</A> / <A HREF="chapter3.html">Chapter III</A> / <A HREF="chapter4.html">Chapter IV</A> / <A HREF="chapter5.html">Chapter V</A> / <A HREF="chapter6.html">Chapter VI</A> / <A HREF="chapterA.html">Appendix</A><HR><SMALL><I>Mechanically translated to HTML from third edition as revised 16 May 1997. Copyright © Graham Nelson 1993, 1994, 1995, 1996, 1997: all rights reserved.</I></SMALL></BODY></HTML>