1
<HTML><HEAD><TITLE>Answer to Exercise 2</TITLE></HEAD>
2
<BODY BGCOLOR="#FFFFFF">
3
<TABLE><TR><TD Valign="top"><IMG SRC="../icons/exercise.gif" ALT="??"><TD bgcolor="#FAA89B"><B>ANSWER TO EXERCISE 2</B><TR><TD><TD>
7
Object medicine "guaranteed child-proof medicine bottle" cupboard
8
with name "medicine" "bottle",
9
description "~Antidote only: no preventative effect.~",
11
[; give self open ~locked; "The bottle cracks open!";
13
has container openable locked;
16
Any other code in the game can send the message <TT>medicine.openup()</TT>
17
to crack open the bottle. For brevity, this solution assumes that
18
the bottle is always visible to the player when it is opened -- if not
19
the printed message will be incongruous.
21
<HR>Back to <A HREF="../section8.html#ex2">the exercise in section 8</A><HR>
22
<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>