!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ! Stargate Interactive Fiction ! Written by Don McDonald for CIS 587 - Dr. Maxim ! Stargate SG-1 is based on the feature film, "Stargate" created by ! Dean Devlin and Roland Emmerich. The television series was created by ! Jonathan Glassner and Brad Wright for Metro-Goldwyn-Mayer Inc. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Constant Story "Lonely Traveler"; Constant Headline "^An Interactive Fiction game by Don McDonald ^Stargate SG-1 is Trademark of Metro-Goldwyn-Mayer Inc.^^"; ! The game is meant to be experimented with, so we always define: !Constant DEBUG; Include "parser"; Include "verblib"; Include "grammar"; Release 1; Global kill_attempts; Global thor_answers; Attribute examine_gem; Attribute dialed; ! Makes it easier to distinguish between ! location and items. Class Room has light; !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !! Start the game in the woods !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! [ Initialise; location = woods; print "^^^It's a nice summer day in the woods, but looks can be^ deceiving. You then remember that you are not on Earth and were^ knocked out after you were separated from the rest of your team.^ You need to get back to the stargate to get home.^^^"; ]; ! This is a dummy room to hide objects from view until ! they can be discovered by other means Object Undiscovered "hidden treasure room" with description "You must have read the source to get here!?."; !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !! Setting for initial location--in the woods !! Contains the rifle and clip (clip needs to !! be put into the rifle for it to work). !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Room woods "Woods" has light with name "woods" "forest" "trees", description [; if (self hasnt visited) { print "Your head throbs and you feel the lump on the back of^ your head and wonder how long you have been out. There are^ trails to the west, north, and northwest.^"; } else { print "There are trails to the west, north, and northwest.^"; } ], w_to cave, n_to mountains, nw_to cabin_clearing, cant_go "There is no trails in this direction."; !! The clip is hidden under the leaves and if !! searched or examined the clip moves to the woods !! so it can be seen Object leaves "leaves" woods with name "Leaves" "leaf", description "They look like normal leaves from the surrounding trees.^", before [; push: if (clip in Undiscovered) { give leaves concealed; move clip to location; print "With the leaves out of the way, a fully loaded clip^ is visible."; rtrue; } search: print "They look like normal leaves from the surrounding trees.^"; rtrue; ], has pluralname; !! This is the rifle is the standard SG weapon !! and will be used only to kill the jaffa Object rifle "Rifle" woods with name "gun" "rifle" "weapon" "firearm", description "Standard SG-1 Issue firearm.", when_open "You see a Rifle", has open container; !! Not much use at this time. Something to keep !! the player wondering what they are forgetting Object -> vest "Vest" with name "vest", description "Standard SG-1 Issue utility vest"; !! This clip must be inserted into the gun to !! make it work. The clip is hidden under the leaves. !! If the leaves are moved, the clip moves with !! them. If the leaves are searched or examined, the !! clip will become visible. It moved from undiscovered !! to the woods when leaves are searched. Object clip "Clip" Undiscovered with name "clip" "bullets" "bullet", description "The clip contains the bullets for Rifle.", before [; insert: if (rifle notin player) { print "You must be holding the rifle before you can insert the clip.^"; rtrue; } if (clip notin rifle) { move clip to rifle; print "You insert the clip into the rifle. It is now ready to fire.^"; rtrue; } else { print "The clip is already in the rifle!^"; rtrue; } ]; !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !! Setting for confrontation with jaffa !! Player needs to get the rock and the gem !! for later !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Room cave "Cave" with name "cave", description "A darkened cave is in view. There are trails to north, east, and northeast.^", e_to Woods, n_to cabin_clearing, ne_to mountains, cant_go "There is no trails in this direction."; Object rock "Rock" cave with name "rock", description "It is a rock, what else can be said.", has concealed; !! The player needs to be careful to have !! the rifle and the clip loaded to shoot !! the jaffa, otherwise the player is warned. !! If these warnings are not heeded the player !! is killed. Object jaffa "Jaffa" cave has animate, with name "Jaffa", initial "A formidable looking armor clad jaffa stands^ at the cave entrance.", description "The jaffa guards the cave entrance.", life [; Ask, Answer, Order: "The Jaffa simply stares back at you."; Attack: if (rifle notin player || clip notin rifle) { switch (kill_attempts) { 0: print "Jaffa points his staff weapon. If you persist with^ this activity without the proper equipment, it^ could get ugly for you.^"; kill_attempts++; 1: ! There is a small chance you will die here, but if ! if were this stubborn, you will most likely next the next ! attempt. if (random(100) > 95) { deadflag = 1; print "The Jaffa had no patience and has^ taken you out without a second thought.^ Maybe you will be more cautious next time.^"; kill_attempts++; } else { print "The Jaffa is ready to fire. I would^ recommend leaving the area or else. Or else^ what, you ask. (If you have to ask you should^ be shot now).^"; kill_attempts++; } 2: ! You persisted to do a dumb thing and finally pissed him off ! and he shot you. deadflag = 1; print "Not the most saavy game player, are you? You were^ sufficiently warned and there was a rifle in the woods^ that you could have at least tried."; kill_attempts++; } rtrue; } else { give gem ~concealed; move gem to cave; give rock ~concealed; kill_attempts = 0; remove jaffa; print "The jaffa falls over dead hitting his head on a rock^ that jars a red shiny object from his helmet.^"; rtrue; } ]; !! This gem is used later in the game but first !! must be found by killing the jaffa and then !! examining the object that falls !! then taking it. Object gem "Gem" jaffa has concealed, with name "Gem" "Jewel" "Diamond" "shiny" "object" "something unusual" "something" "unusual" "something", short_name [; ! The gem is not hidden any longer but ! if the 'Object has not been examined, ! it still prints an ambiguous description if (self hasnt concealed) { if (self hasnt examine_gem) { print "something unusual"; rtrue; } } ], description [; ! If not concealed (Jaffa was killed) and ! not examined hint that the object is something ! but if already examined, print that object is gem if (self hasnt concealed) { if (self hasnt examine_gem) { print "An object lies near the jaffa's helmet."; } else { print "A Gem lies next to the jaffa's helmet."; } } ], before [; examine, search: if (self hasnt concealed) { give gem examine_gem; print "The object appears to be a red gem but since you are^ not a gemologist, you are not sure of what type it is."; rtrue; } take: if (self hasnt examine_gem) { print "Don't you want to know what it is that^ you are taking?"; rtrue; } ]; !! This are contains a hologram of the !! asgard 'Thor'. Room mountains "Mountains" has light, with name "hills" "foothills", description "You reach the base of a large mountain range. There^ are trails to south, west, and southwest.^", s_to woods, w_to cabin_clearing, sw_to cave, cant_go "There is no trails in this direction."; !! The alien is a hologram and will only talk to the !! the player. The second attempt is the most useful !! information. Object alien "Alien" mountains has animate, with name "Asgard" "alien" "thor", description "An odd looking gray alien stands with the mountains^ in the background.^^", life [; Ask, Answer: switch (thor_answers) { 0: print "I am Thor of the Asgard, an advanced race at war with^ the Goa'uld. This planet is controlled by the Goa'uld with^ their jaffa guards."; thor_answers++; 1: print "^The stargate is located north of here, but the^ mountains are impassable. The Dial Home Device requires^ the address of the destination planet. (It is this point^ that you figure out you're not in Kansas anymore.)^"; thor_answers++; 2: print "^I am Thor an Asgard emissary. This planet is^ controlled by the Goa'uld with their jaffa guards.^"; } rtrue; Attack: if (rifle notin player) { ! You do not have a gun to shoot with print "Shoot with what?^"; rtrue; } else if (clip notin rifle) { ! Pretty tricky, need to put the bullets into the gun^ print "Rifle clicks at each pull of the trigger. (Oops, seems^ you have forgotten the simplest rule of firearms.)^^"; rtrue; } else { print "Your bullets pass right through the alien and you^ realize that this is just a hologram.^"; rtrue; } ]; !! The cabin contains the glyphs of the address !! home but the player does not know what the !! glyphs are. First they must get inside by !! throwing the rock at the window and breaking it Room cabin_clearing "Cabin" has light, with name "clearing", description "You enter a small clearing in the forest with a cabin.^ There are trails to the south, north, east, west, and southeast.^", before [; throwat: if (noun == rock && second == cabin_window) { give cabin_window ~locked; give cabin_window open; move rock to inside_cabin; print "The window shatters. The window is slightly above your head but you can easily climb through it.^"; rtrue; } Attack: if (noun == cabin_window) { if (rifle notin player) { ! You do not have a gun to shoot with print "Shoot with what?^"; rtrue; } else if (clip notin rifle) { ! Pretty tricky, need to put the bullets into the gun^ print "Rifle clicks at each pull of the trigger. (Oops, seems^ you have forgotten the simplest rule of firearms.)^^"; rtrue; } else { give cabin_window ~locked; give cabin_window open; print "You shoot at the window and it shatters. The window^ is slightly above your head but you can easily climb^ through it.^"; rtrue; } } enter: if (noun == cabin_window) { if (cabin_window hasnt locked && cabin_window has open) { <>; } } ], door_to cabin_window, door_dir u_to, u_to cabin_window, e_to mountains, s_to cave, se_to woods, n_to clearing, w_to stargate, cant_go "There is no trails in this direction."; Object cabin_window "Window" cabin_clearing has light door openable static locked, with name "window", description "You can not see through the dirty window which is slightly^ above your head.", door_to inside_cabin, door_dir w_to, w_to inside_cabin; Object cabin_door "Door" cabin_clearing has light door openable static locked, with name "door", description "It is just a door.^"; Room inside_cabin "Inside" has light, with name "cabin", description "The cabin is a single room building with very few amenities.^", before [; exit: playerto(cabin_clearing); rtrue; ], u_to cabin_clearing, cant_go "The window is slightly above your head but you can easily climb through it."; Object table "Table" inside_cabin has supporter, with name "table", description "An unspectacular beat up, plain table.", before [; Push: if (paper has concealed) { print "You push the table across the room and notice a piece of^ paper under the table leg.^"; give paper ~concealed; move paper to location; rtrue; } Take: print "Why would you want to carry around a table?^"; rtrue; ]; ! The paper is hidden under the leg of the table ! so it is put in undiscovered until the table is ! moved and the paper is discovered. Object paper "Paper" Undiscovered has concealed, with name "paper", description "The paper contains 'glyphs' that look vaguely familiar"; ! This chair is only there to make it look like a real ! interior, it does nothing spectacular Object chair "Chair" inside_cabin has supporter, with name "chair", description "The chair is a plain wood chair.", before [; Take: print "Why would you want to carry around a chair?^"; rtrue; ]; ! This clearing contains a statue but more importantly ! contains the necessary fuse for the Stargate Room clearing "Clearing" has light, with name "clearing", description "You emerge from the woods to a clearing. The area^ looks like some kind of shrine. There is a trail only to the^ south.^", s_to cabin_clearing, cant_go "There is no trails in this direction."; Object statue "Statue" clearing has light, has static, with name "statue", initial "A statue of a Goa'uld (or as they call themselves^ 'Gods') is in the clearing", description [; if (fuse in clearing) { print "The appearance of the Goa'uld is surprisingly human ^ with the exception of something unusual about the eyes.^ The hand of the statue has what appears to be a weapon on^ it (although it is not a weapon you are familiar with). There is^ an cylindrical object that resembles a fuse, wedged in the hand weapon."; } else { print "The appearance of the Goa'uld is surprisingly human ^ with the exception of something unusual about the eyes.^ The hand of the statue has what appears to be a weapon on^ it (although it is not a weapon you are familiar with).^"; } ], before [; examine: give fuse ~concealed; ]; Object weapon "Goa'uld Weapon" clearing has static concealed, with name "weapon", description "Some type of hand device, you're not sure how it^ works or what it would the person it was used against."; Object fuse "Fuse" clearing has concealed, with name "fuse" "cylinder" , description "The fuse goes to some type of electronic device."; Room stargate "Stargate" has container open, with name "ring" "stargate", description "You see the large ring at the end of the woods.^ The Stargate has an outer ring containing symbols and chevrons.^ Symbols are entered on the DHD to provide an address of the^ the desired planet. The inner ring turns to lock the cheverons^ to the symbols entered on the DHD. There is a trail leading to^ the east.^", number 0, ! <-- used by the daemon !every turn run the daemon each_turn [; StartDaemon(self); ], daemon [; if (location ~= stargate) { stopdaemon(self); self.number = 0; } else { switch (++self.number) { 1: if (self has general) { print "^^The Death Gliders are coming back.^"; } else { print "^^You hear the distinct sounds of Goa'uld Death Gliders.^"; give self general; } 2,3,4,5,6,7,8: "^You continue to hear the distinct sounds of the Death^ Gliders."; 9: "^The roar of the Death Glider becomes almost deafening^, it must be very close now.^"; 10: print "^The Death Glider is in view and begins its^ attack...^"; if (random(100) > 90) { remove player; print "You have been hit by the death gliders^ shots...^"; deadflag = 1; } else { print "^Its shoots barely miss you as they^ whiz past you head.^"; self.number--; } } } ], before [; insert: ! The DHD must be open before you can put stuff in it if ((dhd has open) && (second == dhd)) { if ((noun == fuse) && (second == dhd)) { print "You insert the fuse into a slot in the dhd.^ The red dome in the middle of the dhd lights up,^ Power has been restored to the Stargate and DHD.^"; move fuse to dhd; give dhd general; rtrue; } else if (noun == gem) { print "You insert the gem into a hole that matches its shape.^"; } else if (noun == paper) { print "The paper might catch on fire if it is inserted^ into the DHD with all the electrical power in there.^"; } } push: if (noun == dhd) { if (dhd hasnt general) { ! It is not working without the power. print "Nothing happens. The DHD does not appear to^ be powered up (there are no lights).^"; rtrue; } else { ! If you got the paper in the cabin then we will assume ! you are reading the glyphs and pushing those buttons. ! Otherwise, just random buttons. if (paper in player) { print "Remembering the glyphs from paper in the^ cabin, you push those glyphs on the DHD. As each^ button is pushed it lights up. You finally push the^ red dome in the middle of the DHD and a wormhole at^ the Stargate to Earth is established.^"; give dhd dialed; rtrue; } else { print "You push random glyphs on the DHD and then the red dome in the center but nothing happens.^"; rtrue; } } } enter: ! Game Over, we have a winner. if (noun == stargate) { if ((dhd has general) && (dhd has dialed)) { remove self; print "^^You are on your way back home for your next adventure..."; deadflag = 2; ! Game over, you win rtrue; } else { print "You walk through the ring and fall off the other ^ side of the raised platform, Perhaps you should use the^ DHD to dial home first.^"; rtrue; } } else if (noun == dhd) { print "You would have to lose a few pounds to fit into^ something that small.^"; } ], after [; insert: if ((second == dhd) && (noun == fuse)) { ! The message has already been printed. ! rtrue; } remove: ! If either the fuse or the gem is removed from the ! dhd, take away the general flag so next time they ! are both inserted, the dhd will light up again. if ((noun == dhd) && (second == fuse)) { print "All the lights on the DHD turn out and the system^ powers down.^"; give dhd ~general; give dhd ~dialed; } go: ! Starts the death gliders upon entering the area if (noun == w_obj) { StartDaemon(self); } ], e_to cabin_clearing, cant_go "There is no trails in this direction."; Object dhd "DHD" stargate has container openable locked lockable, with name "dhd" "dial home device" "glyphs" "buttons", description [; if (self has open) { print "The front panel on the DHD is open exposing the^ high tech electronics. There is a cylindrical clip in^ DHD.^"; } else { print "The Dial Home Device (DHD) has buttons with glyphs^ on each button that match the glyphs on the Stargate.^ It has a faceted looking indentation near base (alright kinda like a big gem).^"; } ], ! when_open "The front panel on the DHD is open exposing it's^ ! inner workings.^", ! when_closed "The Dial Home Device (DHD) with rings of glyphs^ ! that match the glyphs on the Stargate and a red^ ! dome in center.", with_key gem, before [; Take: print "It is fixed to the ground and wired to the^ Stargate. You might want to examine the object^ before blindly taking objects.^"; rtrue; ]; ! Add verb shoot to perform same action as attack. Verb "shoot" * noun -> attack * noun "attack" -> attack * "attack" noun -> attack; ! Cover as many possible verbs for talking to the alien as possible Verb 'talkto' * creature 'about' topic -> Ask; Verb 'talk' * 'to' creature->Ask; Extend 'ask' first * creature ->Ask; Extend 'speak' first * 'to' creature ->Ask; Verb 'yell' * 'at' creature ->Ask; ! Extend the insert verb to put. Extend "put" * "into" noun ->insert; ! Dialing the DHD is the same as pushing Verb 'dial' * noun -> push; ! Extend the climb verb to climb through window Extend 'climb' first * 'through' noun ->Enter;