Answer to Exercise 84

| ANSWER TO EXERCISE 84
| In the `Initialise` routine, move `newplay` somewhere and `ChangePlayer` to it, where:
    Object newplay "yourself"
      with description "As good-looking as ever.", number 0,
           add_to_scope nose,
           capacity 5,
           before
           [;  Inv: if (nose has general) print "You're holding your nose.  ";
               Smell: if (nose has general)
                         "You can't smell a thing with your nose held.";
           ],
      has  concealed animate proper transparent;

    Object nose "nose"
      with name "nose", article "your",
           before
           [; Take: if (self has general)
                       "You're already holding your nose.";
                    if (children(player) > 1) "You haven't a free hand.";
                    give self general; player.capacity=1;
                   "You hold your nose with your spare hand.";
              Drop: if (self hasnt general) "But you weren't holding it!";
                    give self ~general; player.capacity=5;
                    print "You release your nose and inhale again.  ";
                    <<Smell>>;
           ],
      has  scenery;

Back to the exercise in section 28

Mechanically translated to HTML from third edition as revised 16 May 1997. Copyright © Graham Nelson 1993, 1994, 1995, 1996, 1997: all rights reserved.