! >CA There are two exceptions to the ordinary before/after rules, for ! vehicles and things which can be pushed from place to place: this car ! demonstrates both at once. ! ! The "before" for PushDir (push in a named direction) must call ! AllowPushDir and then return true to signify that the push is legal. ! ! The "before" for Go must return true to signify that travelling in ! the object is legal. (Note that it must also be enterable.) ! ---------------------------------------------------------------------------- Object -> car "little red car" with name "little" "red" "car" "kar1", description "Large enough to sit inside. Among the controls is a prominent on/off switch. The numberplate is KAR 1.", when_on "The red car sits here, its engine still running.", when_off "A little red car is parked here.", before [; PushDir: AllowPushDir(); rtrue; Go: if (car has on) { Achieved(1); "Brmm! Brmm!"; } print "(The ignition is off at the moment.)^"; ], after [; PushDir: "The car rolls very slowly as you push it."; ], has switchable enterable static container open; Object -> -> "small note" with name "small" "note", description " !!!! FROBOZZ MAGIC CAR COMPANY !!!!^ ^Hello, Driver!^ ^Instructions for use:^ ^Switch on the ignition and off you go!^ ^Warranty:^ ^This car is guaranteed against all defects for a period of 76 milliseconds from date of purchase or until used, whichever comes first.^ ^Good Luck!"; ! ----------------------------------------------------------------------------