! >HE The balloon is completely self-contained as a piece of code, except ! that it does not set itself going (though even this could have been ! arranged): it is set going in the Initialise() routine. ! ! Notice that the "after" for Drop takes away the "moved" attribute. ! This is one way to ensure that the "initial" message will always be ! the one displayed. (Alternatively, we could have given it a "describe" ! property.) ! ---------------------------------------------------------------------------- Object -> balloon "helium balloon" with description "Blue, with a yellow smile.", name "helium" "balloon" "blue" "string", initial "A balloon nestles on the ceiling, its long string hanging.", before [; Attack: remove self; StopDaemon(self); "Easily, you burst the balloon. Pop!^^ Shame it was irreplaceable, really."; ], after [; Take: "You take the balloon by its string. It's buoyant!"; Drop: give balloon ~moved; "The balloon rises gracefully to the ceiling."; ], daemon [ from_room to_room; if (random(3)~=1) rfalse; from_room=parent(self); if (from_room==East_End or West_End) to_room=Toyshop; if (from_room==Toyshop) { if (random(2)==1) to_room=East_End; else to_room=West_End; } if (to_room==0) rfalse; move self to to_room; if (location==from_room) "^A breeze blows the balloon away to the ", (name) to_room, "."; if (location==to_room) "^A breeze blows the balloon in from the ", (name) from_room, "."; ]; ! ----------------------------------------------------------------------------