! ! ! ! Author: Mark Lee ! File: prog3.inf ! Purpose: This game implements an interactive ! text game as described in assingment #3 ! ! Constant Story "Escape from the Space Pirates^"; Constant Headline "^An interactive fiction game produced for CIS 490A^"; ! The game is meant to be experimented with, so we always define: Constant DEBUG; Release 1; Serial "061599"; Include "Parser"; ! -------------------------------------------------------------------------- ! a sack is provided in case the player wants to put something in it ! the back pack is moved to the Brig in the initailazation routine ! located near the end of the program ! Object back_pack "back pack" with description "A black back pack.", name "pack" "back pack" "bag", article "your", when_closed "A back pack lies on the floor.", when_open "A back pack lies open on the floor.", has container open openable; Constant SACK_OBJECT = back_pack; ! -------------------------------------------------------------------------- Constant MAX_SCORE 1950; Constant OBJECT_SCORE 50; Constant ROOM_SCORE 50; Include "VerbLib"; ! -------------------------------------------------------------------------- Global pow_points = 0; ! flag the ships power is off ! a key to open the tresure hold Class Key with name "key"; ! dilitium crystal to resart the ships engine Class Dilithium with name "dilithium"; ! A dilithium chamber - moved to the engine room on init Class D_Chamber with name "Chamber", capacity 1, has transparent container open static; ! -------------------------------------------------------------------------- !-------- Rooms & other objects -------- ! -------------------------------------------------------------------------- Key Hold_Key "key to the hold" with name "key"; ! This is where the player starts the game Object Cell "Jail Cell" has light with description "The jail cell a small room in the brig of the pirate's space ship, the force field that once kept you inside has gone off.^ You could step out into the brig.^" , initial [;if ( Cell hasnt visited ) Title_Page();], out_to Brig ; ! -------------------------------------------------------------------------- Object Brig "Brig" has light with description [;if (Brig_Door has open) print "The brig is a small room with one jail cell in it.^ The pirates used to keep their guests here.^ ^ You could go into the cell."; else print "The brig is a small room with one jail cell in it.^ The pirates used to keep their guests here.^ ^ You could go into the cell.";] , initial [;if ( Brig hasnt visited ) score = score+50;], in_to Cell , out_to Brig_Door, S_to Brig_Door ; ! -------------------------------------------------------------------------- Object Brig_Door "brig door" with name "door" "brig door", description "It's just a door.", when_closed [; if (location==Brig) print "A door out to the south is closed"; if (location==Cor7) print "A door that says BRIG on blocks the way to the north.";], when_open [; if (location==Brig) print "A door leading to the south is open."; if (location==Cor7) print "A door leading north to the Brig is open.";], door_dir [; if (location==Brig) return Cor7; else return Brig;], door_to [; if (location==Cor7) return Brig ; else return Cor7; ], found_in Cor7 Brig has light static door openable; ! -------------------------------------------------------------------------- Object Cor7 "Corridor 7 West" has light with description [;if(Brig_Door has open){ print "Corridor 7 West, it is a wide yellow hallway. With connections^ South to another corridor or^ West to yet another corridor or^ This corridor continues to the East"; } else{ print "Corridor 7, it is a wide yellow hallway. With connections^ South to another corridor or^ West to yet another corridor or^ This corridor continues to the east";}], initial [;if (Cor7 hasnt visited) score = score+50;], in_to Brig_Door , N_to Brig_Door, S_to Cor6, W_to Cor1, E_to Cor7A ; !-------------------------------------------------------------------------- Object Cor7A "Corridor 7 East" has light with description [;if(Sick_Door has open) print "Corridor 7 East, it is a wide yellow hallway. There are openings^ The corridor continues to the west.^ East to the Sick Bay"; else print "Corridor 7 East, it is a wide yellow hallway.^ This corridor continues to the west";], initial [;if (Cor7A hasnt visited) score = score+50;], W_to Cor7, E_to Sick_Door, in_to Sick_Door ; ! -------------------------------------------------------------------------- Object Sick_Door "Sick Bay door" with name "door" "Sick Bay door", description "It's just a door that says 'Sick Bay' on it.", when_closed [; if (location==Sick_Bay) print "A door out to the West is closed"; if (location==Cor7A) print "A door that says 'Sick Bay' on it blocks the way to the east.";], when_open [; if (location==Sick_Bay) print "A door leading to the west is open."; if (location==Cor7A) print "A door leading east to the Sick Bay is open.";], door_dir [; if (location==Sick_Bay) return Cor7A; else return Sick_Bay;], door_to [; if (location==Cor7A) return Sick_Bay ; else return Cor7A; ], found_in Cor7A Sick_Bay has light static door openable; ! -------------------------------------------------------------------------- Object Cor1 "Corridor 1" has light with description "Corridor #1 it is wide blue hallway. You could go^ North into the Bridge or^ East to another cooridor or^ West to a corridor", initial [;if (Cor1 hasnt visited)score = score+50;], N_to Bridge , S_to Hold_Door, W_to Cor2, E_to Cor7 ; ! -------------------------------------------------------------------------- Object Hold_Door "Door to the Hold" with name "door" , description "The massive metal door bars the way to the hold", door_dir [; if (location==Cor1) return s_to; return n_to; ], door_to [; if (location==Tres_Hold) return Cor1; return Tres_Hold; ], when_closed [; if (location==Tres_Hold) print "A door leading to the north is closed"; if (location==Cor1) print "A door that says 'Hold' on it blocks the way to the South.";], when_open [; if (location==Tres_Hold) print "A door leading to the north is open."; if (location==Cor1) print "A door leading south to the Ship's Hold is open.";], with_key Hold_Key, found_in Cor1 Tres_Hold has locked static door openable lockable; ! -------------------------------------------------------------------------- Object Cor2 "Corridor 2" has light with description "This is Corridor #2 it is a short green hallway. You could go^ North into the Crew Cabins or^ East to another cooridor or^ West to a corridor", initial [;if (Cor2 hasnt visited)score = score+50;], N_to Crews_Quarters , W_to Cor3, E_to Cor1, S_to Cap_Door ; ! -------------------------------------------------------------------------- Object Cap_Door "Captain's door" with name "door" "Captains quarters door", description "It's just a door that says 'Captain' on it.", when_closed [; if (location==Captains_Quarters) print "A door leading out to the north is closed."; if (location==Cor2) print "A door that says 'Captain' on it blocks the way to the south.";], when_open [; if (location==Captains_Quarters) print "A door leading out to the north is open."; if (location==Cor2) print "A door leading south to the Captain's Quarters is open.";], door_dir [; if (location==Captains_Quarters) return Cor2; else return Captains_Quarters;], door_to [; if (location==Cor2) return Captains_Quarters ; else return Cor2; ], found_in Cor2 Captains_Quarters has light static door openable; ! -------------------------------------------------------------------------- Object Cor3 "Corridor 3" has light with description "This is Corridor #s it is a short pink hallway. You could go^ South to a corridor or^ East to a corridor", initial [;if (Cor3 hasnt visited)score = score+50;], E_to Cor2, S_to Cor4, W_to Gal_Door ; ! -------------------------------------------------------------------------- Object Cor4 "Corridor 4" has light with description "This is Corridor #4 is is a long white hallway. You could go^ North into a corridor or^ East to another cooridor", initial [;if (Cor4 hasnt visited)score = score+50;], N_to Cor3 , S_to Eng_Door, E_to Cor5 ; ! -------------------------------------------------------------------------- Object Cor5 "Corridor 5" has light with description "This is Corridor #5 it is a very short blue hallway. You could go^ North into a corridor or^ West to yet another cooridor", initial [;if (Cor5 hasnt visited)score = score+50;], N_to Cor6 , W_to Cor4 ; ! -------------------------------------------------------------------------- Object Cor6 "Corridor 6" has light with description "This is Corridor #6 it is a long orange hallway. You could go^ North into a corridor or^ South to yet another cooridor^ West to the Transporter Room", initial [;if (Cor6 hasnt visited)score = score+50;], N_to Cor7 , S_to Cor5 , W_to Transporter_Room, E_to Air_Door ; ! -------------------------------------------------------------------------- Object Air_Door "Air Look door" with name "door" "Air Lock door", description "It's just a door that says 'Air Lock' on it.", when_closed [; if (location==Air_Lock) print "A door leading out to the west is closed."; if (location==Cor6) print "A door that says 'Air Lock' on it blocks the way to the east.";], when_open [; if (location==Air_Lock) print "A door leading to the west is open."; if (location==Cor6) print "A door leading east to the Air Lock is open.";], door_dir [; if (location==Air_Lock) return Cor6; else return Air_Lock;], door_to [; if (location==Cor6) return Air_Lock ; else return Cor6; ], found_in Cor6 Air_Lock has light static door openable; ! -------------------------------------------------------------------------- Object Transporter_Room "Transporter Room" has light with description "The Transporter room.." , initial [;if ( Transporter_Room hasnt visited ) score = score+50;], E_to Cor6 ; Object -> "Ship's Transporter" with name "transporter" , initial "The Ship's Transporter is quiet, perhaps it's unplugged?^ There is a power switch and a screen on the front of the transporter.", before [; SwitchOn: <>; SwitchOff: <>; Examine: <>; ], has transparent; Object -> -> T_button "power button" with name "power" "button" "switch", after [; SwitchOn, SwitchOff: <>; ], has switchable; Object -> -> tscreen "television screen" with name "screen", before [; Examine: if (T_button hasnt on) "The screen says: Power off"; if (pow_points == 1) { print "The Screen Says: Transporter ready beam down coordinates set to Earth."; deadflag = 2; score = score + 200; } else { print "The Screen Says: Power too low to transport."; < Switchoff T_button>;}; ]; ! -------------------------------------------------------------------------- Object Engine_Room "Engine Room" has light with description "The Engine room.." , initial [;if ( Engine_Room hasnt visited ) score = score+50;], N_to Eng_Door, !cor4 ; Object -> "Ship's Engine" with name "engine" , initial "The Ship's mighty engines are quiet, may be it's unplugged?^ There is a power switch and a screen on the front of the engine.", before [; SwitchOn: <>; SwitchOff: <>; Examine: <>; ], has transparent; Object -> -> power_button "power button" with name "power" "button" "switch", after [; if (pow_points == 0 && (d1 in dc1)){ pow_points =1 ; score = score + 300;} SwitchOn, SwitchOff: <>; ], has switchable; Object -> -> screen "television screen" with name "screen", before [; Examine: if (power_button hasnt on) "The screen says: Power out.."; if (d1 in dc1) "The Screen Says: Power level at maximum"; else "The Screen Says: Power out -> Dilithium chamber needs filling."; ]; ! -------------------------------------------------------------------------- Object Eng_Door "Engine Room door" with name "door" "Engine Room door", description "It's just a door that says 'Engine Room' on it.", when_closed [; if (location==Engine_Room) print "A door leading out to the north is closed."; if (location==Cor4) print "A door that says 'Engine Room' on it blocks the way to the south.";], when_open [; if (location==Engine_Room) print "A door leading north is open."; if (location==Cor4) print "A door leading south to the Engine Room is open.";], door_dir [; if (location==Engine_Room) return Cor4; else return Engine_Room;], door_to [; if (location==Cor4) return Engine_Room ; else return Cor4; ], found_in Cor4 Engine_Room has light static door openable; ! -------------------------------------------------------------------------- Object Sick_Bay "Sick Bay" has light with description "There is not much left of the sickbay, the pirates must^ have taken everything with them except.." , initial [;if ( Sick_Bay hasnt visited ) score = score+50;], W_to Sick_Door, Out_to Sick_Door ; ! -------------------------------------------------------------------------- Object Tres_Hold "The Hold" has light with description "The Hold...." , initial [;if ( Tres_Hold hasnt visited ) score = score+50;], N_to Hold_Door ; Object->"Package" with name "package" "my package", after [; Take: score = score + 100; Drop: score = score - 100; ]; Object->"Diamond the size of a fist" with name "diamond" "gem", after [; Take: score = score + 100; Drop: score = score - 100; ]; Object->"Gold bar" with name "gold" "bar", after [; Take: score = score + 100; Drop: score = score - 100; ]; Object->"Chunk of latnum" with name "latnum" "chunk", after [; Take: score = score + 100; Drop: score = score - 100; ]; ! -------------------------------------------------------------------------- Object Galley "The Galley" has light with description "The Galley is a large yellow room, at first glance it^ appears as if there is nothing here but rubble except for.." , initial [;if ( Galley hasnt visited ) score = score+50;], E_to Gal_Door ; ! -------------------------------------------------------------------------- Object Gal_Door "Galley door" with name "door" "Galley door", description "It's just a door that says 'Galley' on it.", when_closed [; if (location==Galley) print "A door leading out to the east is closed."; if (location==Cor3) print "A door that says 'Galley' on it blocks the way to the west.";], when_open [; if (location==Galley) print "A door leading east is open."; if (location==Cor3) print "A door leading west to the Galley is open.";], door_dir [; if (location==Galley) return Cor3; else return Galley;], door_to [; if (location==Cor3) return Galley ; else return Cor3; ], found_in Cor3 Galley has light static door openable; ! -------------------------------------------------------------------------- Object Captains_Quarters "The Captain's Quarters" has light with description "The Captain quarters are quite spartan, there is nothing much here." , initial [;if ( Captains_Quarters hasnt visited ) score = score+50;], N_to Cap_Door ; Object -> "Captain's Log Final Entry" with name "log" "note", description " Captain's Log Final Entry^ ^We are abandoning ship,^ ^We couln't find the key to the tresure hold or^ ^the spare dilithium crystal needed to restart the engine.^ ^I have ordered the ship to self destruct, the space police^ ^will never capture my tresure or my ship." ; ! -------------------------------------------------------------------------- Object Crews_Quarters "The Crew's Quarters" has light with description "The Crew's quarters looks like its large enough to house about^ four people, the pirates must have taken every thin from this^ room with them." , initial [;if ( Crews_Quarters hasnt visited ) score = score+50;], S_to Cor2 ; ! -------------------------------------------------------------------------- Object Air_Lock "The Air Lock" has light with description "The Air Lock is a small room with a hatch to the outside of the ship on the far wall.", initial [;if ( Air_Lock hasnt visited ) score = score+50;], W_to Air_Door ; Object -> "Air Lock Control panel" with name "panel" "lock" "control panel", initial "The Ship's Air Lock is quiet, perhaps too quiet..^ There is a switch and a screen on the front of the Control Panel.", before [; SwitchOn: <>; SwitchOff: <>; Examine: <>; ], has transparent; Object -> -> A_button "power button" with name "power" "button" "switch", after [; SwitchOn, SwitchOff: <>; ], has switchable; Object -> -> Ascreen "television screen" with name "screen", before [; Examine: if (A_button hasnt on) "The Screen Says: Air Lock Ready Operating on Auxiliary Power."; else { print "The Screen Says: Air Lock Opening^"; deadflag = 1; print "Arrrgghhhg!^ You were sucked out into space and exploded.^"; } ]; ! -------------------------------------------------------------------------- Object Bridge "The Bridge" has light with description "The Bridge is smashed up and mostly inoperative.^ There is an exit to the south." , initial [;if ( Bridge hasnt visited ) score = score+50;], S_to Cor1 ; Object -> "Self Destruct Control panel" with name "panel" "Self destruct" "control panel" "destruct", initial "The Ship's Self Destruct Control panel is quiet, perhaps too quiet..^ There is a switch and a screen on the front of the Control Panel.", before [; SwitchOn: <>; SwitchOff: <>; Examine: <>; ], has transparent; Object -> -> D_button "power button" with name "power" "button" "switch", after [; SwitchOn, SwitchOff: <>; ], has switchable; Object -> -> Dscreen "television screen" with name "screen", before [; Examine: if (D_button hasnt on) "The Screen Says: Self Destruct Ready Operating on Auxiliary Power."; else { print "The Screen Says: Self Destruct Count Down Resumed two, one, zero.^"; deadflag = 0; print "Arrrgghhhg!^ You were blown to bits in the explosion.^"; } ]; Object -> "Cscreen" with name "computer" "computer screen" "display", initial "An inoperative computer is here, there is something on the display.", description [; font off; print "^+------------------------------------------+ ^| Log entries: | ^| 8.0 ship under attack. | ^| 8.1 main power out. | ^| 8.2 orbit decay detected | ^| 8.3 self destruct initialized | ^| 8.4 abandon ship ordered. | ^| 8.5 self destruct malfunction | ^| 8.{ &&&&&&&&&&&****(W*)()E(DODIOIDAUDA | ^|IUSDAOIDUODAD)(&)E(Q)E(&AODPAODPOADIDAPP | ^|% | ^+------------------------------------------+^"; font on; ], has static; Object -> "map" with name "map" "ship" "plan" "diagram", initial "A diagram of the Ship is embossed in one wall.", description [; font off; print "^+------------------------------------------+ ^| Crews Bridge Cell | ^| Quarters (you are here) Brig | ^| | | | | ^| ------------------------------- Sick | ^| | | | | Bay | ^| G | Captain Hold | | ^| a | Quarters |-- Air | ^| l---| | Lock | ^| l | Transporter--| | ^| e | Room | | ^| y | | | ^| | | | ^| ----------------------------- | ^| | | ^| Engine | ^| Room | ^+------------------------------------------+^"; font on; ], has static; Dilithium->d1 "Dilithium Crystal" with name "dilithium" "crystals" "dilithium crystals"; D_Chamber -> dc1 "Power Converter Chamber" with name "chamber" "converter chamber" "power chamber" "convereter" "power", description [;if (d1 in self) print "The Dilithium Crystal Chamber glows brightly with some dilitium crystals in side it"; else print "The Dilithium Crystal Chamber is dark"; ] ; ! -------------------------------------------------------------------------- ! -------------------------------------------------------------------------- ! ----------------------------------routines--------------------------------- [ Initialise; location = Cell; ! players initial location move back_pack to Brig; move d1 to Sick_Bay; ! dilithium crystal move Hold_Key to Galley; ! key to tresure room move dc1 to Engine_Room; ! put dilitium crystal in the chamber to start ]; [ Title_Page; style bold; print"^THE STORY SO FAR IS:"; style roman; print"^You landed a new job at United Parcel Service last Friday. Today was^ your first day as a driver. The big brown truck, the open road. It was^ a nice day just like any other day until space pirates kidnapped you.^ They beamed you and the package you were carrying back to their ship.^ They took your package away, and threw you in a little cell with no^ door, but a very potent force field. A few moments later there were lots^ of explosions; screaming, crying, gnashing of teeth kind of stuff. You^ were tossed about the little cell like a rag doll.^"; ]; ! -------------------------------------------------------------------------- Include "Grammar"; ! -------------------------------------------------------------------------- ! anything using verbs extends etc