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

« back to all changes in this revision

Viewing changes to html/section13.html

  • 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
 
<HTML><HEAD><TITLE>Section 13: Switchable objects</TITLE></HEAD>
2
 
<BODY BGCOLOR="#FFFFFF">
3
 
<TABLE></SMALL>
4
 
<TR><TD><TD><P>
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>
6
 
<P>
7
 
 
8
 
<BLOCKQUOTE>
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.'
13
 
<P>...Dennis Spooner,
14
 
<I> The Time Meddler</I>, <I> Dr Who</I>, serial <B> 17</B> (<B>1965</B>)</BLOCKQUOTE>
15
 
 
16
 
 
17
 
<P>
18
 
 
19
 
 
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
23
 
example:
24
 
<PRE>
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;
33
 
</PRE>
34
 
 
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...
38
 
<PRE>
39
 
Object sodium_lamp "sodium lamp"
40
 
  with name "sodium" "lamp" "heavy",
41
 
       describe
42
 
       [;  if (self hasnt on) 
43
 
               "^The sodium lamp squats heavily on the ground.";
44
 
          "^The sodium lamp squats on the ground, burning away.";
45
 
       ],
46
 
       battery_power 40,
47
 
       before
48
 
       [;  Examine: print "It is a heavy-duty archaeologist's lamp, ";
49
 
               if (self hasnt on) "currently off.";
50
 
               if (self.battery_power &#60; 10) "glowing a dim yellow.";
51
 
               "blazing with brilliant yellow light.";
52
 
           Burn: &#60;&#60;SwitchOn self&#62;&#62;;
53
 
           SwitchOn:
54
 
               if (self.battery_power &#60;= 0)
55
 
                  "Unfortunately, the battery seems to be dead.";
56
 
               if (parent(self) hasnt supporter &#38;&#38; self notin location)
57
 
                  "The lamp must be securely placed before being lit.";
58
 
           Take, Remove:
59
 
               if (self has on)
60
 
                  "The bulb's too delicate and the metal frame's too
61
 
                   hot to lift the lamp while it's switched on.";
62
 
       ],
63
 
       after
64
 
       [;  SwitchOn: give self light;
65
 
           SwitchOff: give self ~light;
66
 
       ],
67
 
  has  switchable;
68
 
</PRE>
69
 
 
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.
74
 
<P>
75
 
 
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>.
84
 
</SMALL>
85
 
<TR><TD><TD><P>
86
 
 
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.)
90
 
</SMALL>
91
 
<TR><TD><TD><P>
92
 
 
93
 
 
94
 
</TABLE>
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 &#169; Graham Nelson 1993, 1994, 1995, 1996, 1997: all rights reserved.</I></SMALL></BODY></HTML>