Constant Story "CASK"; Constant DEBUG; Constant Headline "^My first stab at Interactive Fiction^ Copyright (c) 1997 by Harry M. Hardjono.^"; Constant TASKS_PROVIDED; Constant AMUSING_PROVIDED; Constant NUMBER_TASKS = 3; Array task_scores -> 3 5 7; Constant OBJECT_SCORE = 5; Constant ROOM_SCORE = 3; Constant MAX_SCORE = 31; Include "Parser"; Include "VerbLib"; Object Bare_Room "Bare Room" with description "You are standing in the middle of a bare room. There is a steel door to the west and another room to the east. There is a switch on the wall.", w_to Steel_Door, e_to Wine_Room, u_to "The ceiling is much too high!", d_to "You kiss the sweet ground, satisfied?", has light; [ Initialise; location = Bare_Room; "^^^^^^^^^^^^^^^^^Apparently, you have the worst luck in the universe. Here you are, stuck in the middle of nowhere, for days on end. When you first applied for the job, the proprietor assured you that you will be learning the fine art of wine making. That was before he punched your lights out, and locked you here. ^Now you are locked in this small room, nothing on you. No money, no wages, nothing. What a fine mess you are in, fellow. See if you can get out of here. All you have to do is go through the front door. Oh, it's locked? Too bad! I guess you'll just have to stay here until they let you out, hehehehe.^"; ]; !==================================================== [ PrintTaskName ach; switch (ach) { 0: "putting wire in the panel"; 1: "opening the drum cover"; 2: "scaring the elephant"; } ! ach 0: 3 pts ! 1: 5 pts ! 2: 7 pts ! ! item: wire ! 5 ea key ! ! room: Inside_Drum ! 3 ea Small_Garden ! ! Total: 15 + 10 + 6 = 31 ! ]; [ PrintRank; print ", earning you the status of "; switch (score) { 0 to 9 : "~Trapped like a rat!~"; 10 to 19 : "Worker."; 20 to 25 : "Smart Worker."; 26 to 31 : "Master of the Game."; } ]; [ Amusing; print "^Now that wasn't so hard, was it? It's time for your next adventure!.^"; ]; !==================================================== Include "Grammar"; Extend "cut" * noun "with" held -> Cut; Extend "tie" * noun "around" held -> Tie; Extend only "put" * noun "around" held -> Tie; Verb "wrap" * noun "to" held -> Tie * noun "around" held -> Tie * held "with" noun -> Tie * noun "on" held -> Tie; Object -> wire "coil of wire" with name "wire" "coil" "cable" "electric" "copper", initial "A short coil of wire is hanging pathetically from the ceiling. Presumably a lamp is missing.", description [; if (self hasnt general) { "It is a short wire. It looks pathetic hanging from the ceiling"; } "The copper wire is rusty."; ], before [; Take: if (player notin Wooden_chair && self hasnt general) { "You reach for the wire, to no avail! The wire is too high!^"; } ], after [; Take: if (self hasnt general) { give self general; if (lever1 has on) { deadflag = 1; "Eeeeeeeeeyoouch! Millions of kilowatts of electricity burn through your body, frying you crisply. Of course you are dead!"; } "You pull the wire of out from the ceiling. It breaks in two with a snap."; } "You pick up the coil of wire."; Drop: "The wire drops to the floor, slightly coiled."; ], has scored; Object -> Wooden_chair "old wooden chair" with name "old" "wooden" "chair" "seat", article "an", description "The wooden chair is very old and fragile. You wonder if it can hold your weight.", before [; Go: if (noun==d_obj) <>; PushDir: AllowPushDir(); rtrue; ], after [; PushDir: "The chair rickets as you push it."; Go: if (noun==d_obj) rtrue; ], destry [; while (child(Wooden_chair)~=nothing) { move child(Wooden_chair) to location; } remove Wooden_chair; ], has supporter enterable transparent open; Object -> Steel_Door "steel door" with name "steel" "door", description "The steel door is hinged on one side (duh!).", door_to [; if (location==Bare_Room) return Small_Garden; return Bare_Room; ], door_dir [; if (location==Bare_Room) return w_to; return e_to; ], with_key Gold_Key, found_in Bare_Room Small_Garden, has static door lockable openable locked; Object -> lever1 "light switch" with name "electric" "light" "switch", description "The switch goes on and off.", has switchable on static scenery; Object Wine_Room "Wine Room" with description "The room has faint wine odor. Although not quite bare, it still has relatively few noteworthy. A machine is stuck in the corner and a big wooden drum is at the end of the room. Judging by the dust, this room hasn't been used in a long, long time.", before [; Go: if (noun == u_obj) { if (player in Wooden_chair) { if (Drum_Flap has open) { move player to self; <>; } else { "You wish! The drum cover should really be opened before you can climb over the drum."; } } else { "You claw the drum upwards, to no avail! The drum is too tall!^"; }} ], w_to Bare_Room, u_to Drum_Flap, e_to Hole, has light; Object -> rusty_saw "rusty saw" with name "rusty" "steel" "saw", description "It is a rusty saw.", invent [; if (inventory_stage==2) { if (child(self) == Bundle) { " with cloth wrapped around one end"; } rtrue; } ], before [; Tie: if (second == Bundle) { if (child(Bundle) ~= nothing) { "The bundle needs to be empty to be wrapped on the saw."; } give Bundle ~open; move Bundle to rusty_saw; "You wrap the cloth on the saw"; } ], has transparent; Object -> Drum_Flap "drum cover" with name "drum" "flap" "cover" "steel" "iron" "cylinder" "thick" "heavy", description "The drum cover is really a thick and heavy cylinder. You can't really tell much about it other than it fits into the wooden drum nicely, and you wouldn't want to be under it when it comes crashing down.", door_to Inside_Drum, door_dir u_to, number 0, daemon [; if ((lever1 hasnt on) && (child(panel1) ~= nothing)) { self.number++; print "You hear a ~zhwoong~ sound. "; switch(self.number) { 1: if (Hole has general) { give Hole open; if (player in Wine_Room) { print "The cylinder is vacating the hole"; } } 4: if ((player in Inside_Drum) || (player in Wine_Room) || (player in Wooden_chair)) { Achieved(1); print "The cover opens! Now you can enter it if it isn't so darned tall.^"; } give self open; rtrue; 5: if ((player in Inside_Drum) || (player in Wine_Room) || (player in Wooden_chair)) { print "The cover closes.^"; } give self ~open; rtrue; 6: if (player in Inside_Drum) { "You are trapped! The heavy cylinder is coming down to crush you."; } 7: if (player in Inside_Drum) { "The heavy cylinder suddenly looks REALLY heavy to you. You cross your fingers you can get out of here in time. "; } 8: if (player in Inside_Drum) { "The heavy cylinder is still coming down. How do you stop it from coming down? You cross your toes you can get out of here in time."; } 9: if (player in Inside_Drum) { if ((Wooden_chair in Inside_Drum) || (Wooden_chair in player)) { print "The drum crushes the chair like nothing. "; Wooden_chair.destry(); } "The heavy cylinder is right on top of you. Get out now while you can! You cross your arms and legs hoping that you'll be all right. "; } if (Wooden_chair in Inside_Drum && player in Wine_Room) { print "You hear some sounds of cracking wood. "; Wooden_chair.destry(); } if (Wooden_chair in Inside_Drum) { Wooden_chair.destry(); } if (Hole has general) { give Hole ~open; } if (player in Wine_Room) { print "The cylinder is covering the hole"; } 10: if (player in Inside_Drum) { deadflag=1; "The heavy cylinder crushes your body like grapes. I'll spare the details. Suffice to say that you are dead. Weeks later, inspectors wonder why there's a criss-crossed bones lying on the bottom of the drum."; } self.number = 0; rtrue; } } ], has static door; Object -> Hole "hole in the drum" with name "drum" "hole", when_open "There is a big hole on the bottom of the drum.", when_closed [; if (self has general) { "The hole is obstructed by a heavy cylinder."; } "There is a little hole on the bottom of the drum."; ], before [; Cut: if (second == rusty_saw) { if (Bundle in rusty_saw) { if (self hasnt general) { give self general; give self ~concealed; give self open; "You cut the little hole into a big hole."; } "But you already did that!"; } "You cut your fingers on the saw. Ouch!"; } "What do you want to cut the hole with?"; ], door_to [; if (location==Inside_Drum) return Wine_Room; return Inside_Drum; ], door_dir [; if (location==Inside_Drum) return w_to; return e_to; ], found_in Inside_Drum Wine_Room, has static door; Object -> Big_Drum "big wooden drum" with name "drum" "wooden" "big" "old", description "The wooden drum is spacious enough to fit a person inside. You can climb up over the drum if it weren't so darned tall.", has static; Object -> Heavy_machinery "old heavy machinery" with name "old" "heavy" "machine" "machinery" "steel" "iron", article "an", description "The machine has a big button on it, and some illegible writings on the side, and a panel on the bottom.", has static transparent; Object -> -> button1 "big plastic button" with name "big" "glass" "plastic" "transparent" "button", description [; if (lever1 has on) { "The button is a white plastic button, and it has no interesting feature."; } if (self has on) { "The button is glowing green."; } else { "The button is glowing red."; } ], before [; SwitchOn: "You can only push the button"; SwitchOff: "You can only push the button"; Push: if (self has on) { StopDaemon(Drum_Flap); give self ~on; } else { StartDaemon(Drum_Flap); give self on; } print "You push the big plastic button.^"; <>; ]; Object -> -> panel1 "electrical panel" with name "electric" "electrical" "panel" "wires", article "an", description [; if (self has open) { if (child(panel1) == nothing) { "You can see through the open panel that a wire is missing"; } "You can see a bunch of wires in the panel."; } "The panel is closed."; ], before [; Receive: if (noun ~= wire or rusty_saw) "It doesn't fit"; if (child(panel1) ~= nothing) "The machine has already been fixed!"; Search: <>; ], after [; Receive: if (lever1 hasnt on) { deadflag = 1; "Apparently, the wires are ~live~. That is, millions of kilowatts surge through your body, frying you to a crisp."; } if (noun ~= wire) "You jury rigged the machine with ", (the) noun, "."; Achieved(0); "You insert the wire into the panel, fixing the connection."; ], has openable container; Object -> -> Dust "dust" with name "dust", before [; Rub: <>; ], has scenery; Object -> -> writing1 "illegible writings" with name "illegible" "writing" "writings" "note" "notes", description [; font off; if (self hasnt general) { print "^Opewashunal Deweksean:^ To opET tE DFSine. PrDF the 42 to cGDFEG.^ So f4x SFR inHNEt SDGWire in paGSDW.^ SErninS SD FKe ASDFK wFGO RKR^"; } else { print "^Operational Direction:^ To operate the machine: PuXh tWE buDton.^ To fix the machine: Open panel. InsVrt Eire in iE.^ Warning: MaIe Bure there's Yo OleItrOcIDO^"; } font on; rtrue; ], before [; Rub: give self general; "You wipe the dust off the writings."; ]; Object Inside_Drum "Inside drum" with description "The inside of the drum is really smaller than you expect.", w_to Hole, u_to "You claw upwards, to no avail!", has light scored; Object -> Bundle "bundle" with name "bundle" "cloth" "handkerchief" "bandana", description "small bundle made of cloth.", before [; Tie,PutOn: if (second == nothing) { <>; } if (second == rusty_saw) { if (child(Bundle) ~= nothing) { "The bundle needs to be empty to be wrapped on the saw."; } give self ~open; move self to rusty_saw; "You wrap the cloth on the saw"; } Take: if (child(rusty_saw) ~= nothing) { move self to player; give self open; "You untie the bundle from the saw."; } Receive: if (noun ~= Gold_Key || Rat) { "It doesn't fit!"; } ], has container openable; Object -> -> Rat "dead rat" with name "dead" "rat" "mouse" "rodent" "deceased", description "A dead rat. Disgusting!", describe [; "^There a dead rat lies."; ], invent [; "a dead rat"; ], before [; Cut: if (second == rusty_saw) { if (Bundle in rusty_saw) { while (child(self)~=nothing) { print "There is a key inside!^"; move child(self) to location; } remove self; "You shred the rat into nothingness. Good riddance!"; } "You cut your fingers on the saw. Ouch!"; } "What do you want to cut the rat with?"; Receive: if (noun ~= Gold_Key) { "It doesn't fit!"; } ], has container open; Object -> -> -> Gold_Key "gold key" with name "gold" "golden" "key", short_name "golden key", description "It is a small golden key.", has scored; Object Small_Garden "Small Garden" with description "You are standing in the middle of nice-looking small garden", initial [; if (self hasnt visited) { "^^^^^^^^^^^^^ As you walk through the door, a big relief comes upon you. Freedom! Freedom! FREEEEEEEDOOOOOOOOOOOM! You take a deep breath and eagerly look around you to see what the world has to offer.^^ Only to find a certain big, grey, animal blocking the way. You can't really see the face since it is facing the other way. In short, you're looking at the rear end of an elephant.^^ The elephant turns around. Upon seeing you, it blows its trunk and charges head on. Uh-oh! He looks mad! Better get inside the house quick!^"; } ], e_to Steel_Door, has light scored; Object -> Elephant "elephant" with name "big" "gray" "elephant" "jumbo" "dumbo" "mad" "angry", description "an angry looking elephant.", article "an", before [; Receive: if (noun == Rat) { move Rat to Small_Garden; self.destry(); "The elephant dies of a heart attack, but not before it disappears from view.^"; } ], life [; Show, Give: if (noun == Rat) { move Rat to Small_Garden; rtrue; } ], orders [; Take, Examine: if (noun == Rat) { move Rat to Small_Garden; rtrue; } ], destry [; StopDaemon(self); give self absent; remove self; self.number = 0; Achieved(2); deadflag=2; "The elephant shrieks at the sight of the mouse, and run.^"; ], each_turn [; StartDaemon(self); ], number 0, daemon [; if (player in Small_Garden) { self.number++; if (Rat in Small_Garden) { self.destry(); } if (self.number>1) { deadflag=1; "The elephant charges at you. Then it stomps you. Then it, oooh.., I don't think I can describe it further. Suffice to say that you are dead.^"; } } else { self.number = 0; StopDaemon(self); rtrue; } ], has animate;