! My entry in Mark Musante's 2000 Toaster Comp. Don't hit me. ! ! Duncan Cross (duncan_cross@abelgratis.com) Constant Story "SPITTING CRUMBS"; Constant Headline "^An Interactive Toasting by Duncan Cross.^"; Constant MAX_SCORE = 25; Include "Parser"; Include "Verblib"; Include "Grammar"; Include "Utility"; Object bread "piece of bread" with name "piece" "slice" "of" "white" "bread", description "A single slice of white bread.", before [; Insert: if (second == slot_1 or slot_2) { move self to second; "You put the slice of bread into ", (the) second, "."; } Eat: "You would rather have it toasted first."; Take, Remove: if (lever.number == 1) "You can't get it out with your fingers."; ]; Verb "kick" * noun -> attack; Verb "plug" * noun "in" -> PlugIn * "in" noun -> PlugIn * noun "in"/"into" noun -> PlugIn; Verb "unplug" * noun -> Unplug; [ PlugInSub; if (second ~= 0) "You can't plug ", (a) noun, " into ", (a) second, "!"; "There's nothing here to plug ", (the) noun, " into. (I doubt very much whether it can be plugged into anything at all.)"; ]; [ UnPlugSub; print (The) noun, " "; IsOrAre(noun); " not plugged into anything anyway."; ]; Extend 'turn' replace * noun -> Turn * noun 'left' -> TurnLeft * noun 'right' -> TurnRight * noun 'on' -> Switchon * noun 'off' -> Switchoff * 'on' noun -> Switchon * 'off' noun -> Switchoff; [ TurnLeftSub; <>; ]; [ TurnRightSub; <>; ]; [ Initialise; lookmode = 2; location = living_room; move bread to player; "^^^^"; ]; Object bedroom "Bedroom" with description "The only object at all in this room is the bed, which is made of solid oak and suspended from the ceiling by chains.", d_to living_room, has light; Object -> bed "bed" with name "bed", article "the", before [; LookUnder: if (self has general) "You find nothing."; give self general; move rubber_egg to player; "You thrust your arm under the bed and wave it around a bit. Your wrist hits an object, which you hurriedly purloin. It's a rubber egg!"; ], has supporter scenery enterable; Object rubber_egg "rubber egg" with name "rubber" "egg", description "You're a crack shot with one of these.", before [; ThrowAt: if (second == flying_toasters) { remove self; pmove(wounded_toaster, location); score = score + 5; "You hurl the egg straight at the centre of the swarm. For a second, it seems you might not have thrown high enough - but then you hear the clunk of rubber on metal. A toaster soon plummets from the sky and crashes to the ground in front of you."; } ]; Object living_room "Living Room" with description "This is your living room. A huge, dull rug is slapped across the floor, a couple of pictures are nailed onto the tatty walls. The front door is to the north, and a set of stairs go up.", name "rug" "pictures", u_to Bedroom, n_to street, has light; Object street "Street" with description "A wide, deserted, sandy road runs north to south. Tufts of bright green grass dot it randomly. Dense trees line either side of the street.", name "trees", e_to "The trees are too dense.", w_to "The trees are too dense.", s_to living_room, n_to t_junction, has light; Object -> flying_toasters "flying toasters" with name "squadron" "of" "flying" "toasters", initial "A squadron of flying toasters are migrating east, far above you.", description "Eeagh! Stainless steel birds!", before [; Examine: ; default: "They're too high up."; ], has pluralname static; Object wounded_toaster "wounded toaster" with name "wounded" "toaster", initial "A wounded toaster is flapping around madly here, desperately trying to take off.", description "The egg appears to have severely damaged one of its wings. It keeps flapping, pitifully.", before [; Attack: remove self; move toaster to player; score = score + 5; "You kick the toaster against a tree as hard as you can. It falls to the ground, dead. You pick its lifeless corpse, rip off its wings, and cast them aside. You now have a fully working toaster."; Take, Touch, Push, Pull: "The toaster flaps at you and makes it impossible to get near it."; ], has static; Object toaster "toaster" with name "toaster", description [; print "Apart from a large, shallow dent on the back from where it struck the tree, the toaster seems pretty undamaged. There are two parellel slots on the top, a lever on the side, and a dial on the front, as per Musante Toaster Standards. The toaster"; if (self hasnt general) "'s plug is dangling loosely."; " is plugged in."; ], before [; PlugIn: if (self has general) "The toaster is already plugged in."; if (second == 0 && location ~= t_junction) "There is nothing to plug it into."; if (second ~= 0 && second ~= socket or electric_rock) "The plug doesn't seem to fit."; give self general; move self to electric_rock; "You plug the toaster into the socket and lay it down on the rock."; UnPlug: if (self hasnt general) "But it's not plugged in."; give self ~general; "You unplug the toaster."; Receive: if (receive_action == ##puton) rfalse; <>; ], has transparent; Object -> slot_1 "top slot" with name "top" "slot" "slots", has container open static; Object -> slot_2 "bottom slot" with name "bottom" "slot" "slots", has container open static; Object -> lever "lever" with name "lever", description [; print "A pull-down lever, currently in the "; switch(self.number) { 0: print "up"; 1: print "down"; } " position."; ], number 0, time 0, before [; Pull: if (self.number == 1) "It's already in the down position."; if (toaster hasnt general) "You pull the lever down, but it springs right back up again."; if (bread in slot_1 || bread in slot_2) { StartDaemon(self); self.time = dial.number; "You pull down the lever, and the bread starts to cook."; } "You pull the lever down, but it springs right back up again."; Push: if (self.number == 0) "It's already in the up position."; ], daemon [; self.time--; if (self.time ~= 0) rfalse; self.number = 0; StopDaemon(self); remove bread; if (dial.number == 5) { if (location == t_junction) "^A severely burnt piece of toast flies from the toaster and hits the ground, instantly and silently disintegrating."; "^You hear the distant twang of a toaster spring."; } if (dial.number == 1) { move bread to t_junction; if (t_junction == location) "^The bread flies from the toaster and lands on the ground."; "^You hear the distant twang of a toaster spring, followed by a quiet thwap, and finally an explosion."; } remove toaster; switch(dial.number) { 2: toast.short_name = "lightly browned toast"; 3: toast.short_name = "toast"; 4: toast.short_name = "burned toast"; } move toast to t_junction; score = score + 5; if (location == t_junction) "^The toast flies from the toaster and lands on the ground. The toaster then explodes."; "^You hear the distant twang of a toaster spring, followed by a quiet thwap, and finally an explosion."; ], has static; Object -> dial "dial" with name "twisty" "dial", number 1, description [; print "A twisty dial that you can turn left or right. Above it is a small LCD screen that describes the level of toastiness that the dial's position corresponds to. "; if (toaster hasnt general) "It is blank, since the toaster is not plugged in."; print "It is currently set at ~"; Self.Level(); ".~"; ], level [; switch(self.number) { 1: print "Imperceptable Warming"; 2: print "Lightly Browned"; 3: print "Normal"; 4: print "Burnt"; 5: print "Identifiable Only by Dental Records"; } rtrue; ], before [; Turn: "Be more specific - turn it to the left or the right."; TurnLeft: if (lever.number == 1) "The dial seems to be locked."; if (self.number == 1) "The dial won't go any further."; self.number--; print "You turn the dial one notch to the left"; if (toaster hasnt general) "."; print ", putting it into ~"; self.level(); "~ mode."; TurnRight: if (lever.number == 1) "The dial seems to be locked."; if (self.number == 5) "The dial won't go any further."; self.number++; print "You turn the dial one notch to the right"; if (toaster hasnt general) "."; print ", putting it into ~"; self.level(); "~ mode."; ], has static; Object t_junction "T-Junction" with description "You are at a T junction, with exits leading off to the east, south and west.", before [; Go: if (toaster in player && toaster has general) "Not while holding the toaster - the cord doesn't stretch that far."; ], e_to dead_end, w_to at_odd_machine, s_to street, has light; Object -> electric_rock "electric boulder" with name "electric" "boulder", initial "A large boulder sits here, with an electrical socket on the front.", add_to_scope socket, has supporter enterable; Object socket "socket" with name "electrical" "electric" "socket", has static; Object toast with name "toast", short_name "toast", before [; Eat: "You can't eat toast without butter, surely."; ], article "some"; Object dead_end "Dead End" with description "You are at a dead end. Brick walls block every direction, except back west. There is, however, an open window in the northern wall.", w_to t_junction, has light; Object -> buttering_monkey "monkey" with name "monkey", initial "A monkey stares at you through the window.", description "Behind the monkey, you can see some sort of office.", life [; give: if (noun == toast) { remove toast; remove self; move buttered_toast to player; score = score + 5; "The monkey takes the toast, and runs off with it. It then returns, and hands it back to you, buttered. ^^The monkey then explodes."; } ], each_turn [; if (random(3)==1) "^The monkey says, ~Ook!~"; ], has animate; Object buttered_toast "buttered toast" with name "toast", article "some", before [; Eat: "I'd like some jam or honey or something on it too, if it's no trouble."; ]; Object at_odd_machine with short_name [; if (odd_machine in self) { print "At Odd Machine"; rtrue; } print "Empty Location"; rtrue; ], description [; if (odd_machine notin self) "There is nothing to see here. Move along."; "You are standing before a bizarre machine, bizarre beyond description. The bits of it that seem most likely to be of use are a large red button and a spout above a tray."; ], e_to t_junction, has light; Object -> odd_machine "odd machine" with name "odd" "machine", description "The top of the machine is festooned with strange beige pods.", has transparent scenery; Object -> -> large_red_button "large red button" with name "large" "red" "button", before [; Push: if (buttered_toast notin tray) "There is a grinding noise from within the machine, and then a horrible, inhuman scream from one of the pods on top. As the screaming comes to a gurgling stop, the pod seems to deflate, and a lumpy red sludge falls from the spout and onto the tray. After a few seconds it is then sucked away through a tube."; remove odd_machine; move toast_with_stuff_on to location; score = score + 5; "There is a grinding noise from within the machine, and then a horrible, inhuman scream from one of the pods on top. As the screaming comes to a gurgling stop, the pod seems to deflate, and a lumpy red sludge falls from the spout and covers the toast. ^^The machine then explodes."; ], has static; Object -> -> tray "tray" with name "tray", before [; Receive: if (receive_action == ##puton && noun ~= buttered_toast) { move noun to location; "As you place ", (the) noun, " on the tray, a red LED lights on the machine. The tray flips up, and ", (the) noun, " falls to the ground. The LED turns off again."; } ], after [; Receive: if (receive_action == ##puton && noun == buttered_toast) "As you place the buttered toast on the tray, a green LED lights for a second."; ], has static supporter; Object toast_with_stuff_on "toast with stuff on" with name "toast", article "some", before [; Eat: deadflag = 2; "You eat the toast, and explode."; ], has edible;