ANSWER TO EXERCISE 12 | |
(The describe part of this answer but is only decoration.) Note the careful use of inp1 and inp2 rather than noun or second: see the note at the end of Section 9. Object -> macrame_bag "macrame bag" with name "macrame" "bag" "string" "net" "sack", react_before [; Examine, Search, Listen, Smell: ; default: if (inp1>1 && inp1 in self) print_ret (The) inp1, " is tucked away in the bag."; if (inp2>1 && inp2 in self) print_ret (The) inp2, " is tucked away in the bag."; ], describe [; print "^A macrame bag hangs from the ceiling, shut tight"; if (child(self)==0) "."; print ". Inside you can make out "; WriteListFrom(child(self), ENGLISH_BIT); "."; ], has container transparent; Object -> -> "gold watch" with name "gold" "watch", description "The watch has no hands, oddly.", react_before [; Listen: if (noun==0 or self) "The watch ticks loudly."; ]; |