! Alan Batsford ! CIS 487 ! Inform Assignment Constant Story "Contrived Text Adventure Game^"; Constant Headline "By Alan Batsford^"; Constant DEBUG; Include "Parser"; Include "Verblib"; Include "Grammar"; [Initialise; location = StartRoom; lookmode = 2; print "^^You have started another one of those cookie cutter text adventure games. On the screen you see a self important introduction to an uninsteresting story.^^"; ]; Class Room has light; Class Furniture has scenery; global SeeStartKey = 0; global StartKeysTaken = 0; global lbKeysTaken = 0; global SeelbKeys = 0; global SeeReadings = 0; global SeeHatch = 0; Room StartRoom "Starting Room" ! Room the player starts in with Description "A description of the room appears on the screen. It mentions a lockbox in one corner, a door to the north, and table at the center. How typical.", n_to SecondRoom, cant_go "You read a frustrating message that says you can't go that way."; Furniture table "Table" StartRoom !It is a table with Description [;if (keys in player) { print "You read a description of a normal table. The game mentions that the table is empty.^"; } else { print "You read a description of a normal table. The game mentions that you see some keys on the table, and leads you to believe the keys are for the lockbox.^"; }], name 'table', after [; look, examine, search: SeeStartKey = 1;], has supporter; Furniture lockbox "Lock Box" StartRoom !locked box with Description "Description of a small lock box.", name 'box' 'lockbox' 'chest' 'container', before [; unlock: if (StartKeysTaken == 1 && lbKeysTaken == 0) { print "The game informs you that you have been decieved, and that the keys do not work on this lockbox. The original statement that lead you to think the keys were for the lockbox was false, thereby leading you to minor roadblocks. A truly cunning puzzle, right?^"; } else if (lbKeys in player) rfalse;], after [; Open: if (flashlight in player) { "Text appears saying you have opened the lock box, and that it is empty."; } else { "Text appears saying you have opened the lock box, and that you have found a flashlight sitting inside."; }], with_key lbKeys, has container openable lockable locked; Object keys "Keys" table !Keys in start room with Description "Virtual game device given the lable 'keys'. A message leads you to believe the 'keys' are for the 'lockbox'.", name 'keys' 'key', after[; Take: give keys ~concealed; !once the keys are taken unconceal them StartKeysTaken = 1; "You read a message saying you have taken the keys.";], before[; look, take, examine, search: if (SeeStartKey == 0) { "You're not supposed to know about the keys yet because you haven't 'discovered' them with the awkward command system."; }], has pluralname concealed; Object flashlight "Flashlight" lockbox !Flashlight in lockbox with Description "Virtual game device given the lable 'flashlight'. Functionally it's identical to a key, but it's been given a different name so that you feel more imersed in the 'world'.", name 'flashlight', after[; Take: give flashlight ~concealed; !once the flashlight is taken unconceal is "You read a message saying you have taken the flashlight.";], has concealed; Room SecondRoom "Second Room" !Second Room the player reaches with Description "The text on the screen explains how this room is different from the first room, even though its irrelevent anyways. The reading mentions a door to the east, a door to the south, and some arbitrary machine at the center of the room.", e_to ThirdRoom, s_to StartRoom, cant_go "You read a frustrating message that says you can't go that way."; Furniture machine "Machine" SecondRoom !It is a machine with Description "The game explains how the machine has vast importance in the story. It also mentions that you see some writing on the machine along with a hatch", name 'machine' 'contraption' 'object', after [; look, examine, search: SeeReadings = 1; SeeHatch = 1;], has supporter; Furniture writing "Writing" SecondRoom !It is writing with Description "A message appears saying that you read the words 'Lock Box', and you draw the conclusion that the hatch is misproperly labled.", name 'writing' 'words' 'text', before [; look, examine, search: if (SeeReadings == 0) { "You're not supposed to know about the writing yet because you haven't 'discovered' it with the awkward command system."; }], has supporter; Furniture hatch "Hatch" machine !locked box with Description "Description of a hatch on the machine.", name 'hatch', before [; unlock: if (keys in player) rfalse; look, examine, search: if (SeeHatch == 0) { "You're not supposed to know about the hatch yet because you haven't 'discovered' it with the awkward command system."; }], after [; Open: SeelbKeys = 1; if(lbKeys in player) { "Text appears saying you have opened the hatch and discover it empty."; } else { "Text appears saying you have opened the hatch and discovered a new set of keys inside. You are informed that the new keys are identified as boxkey."; }], with_key keys, has container openable lockable locked; Object lbKeys "Lock Box Keys" hatch !Keys in second room with Description "Virtual game device given the lable 'Lock Box Keys'. A message tells you these keys are different looking than the first set of keys.", name 'boxkeys' 'boxkey' 'lockboxkey' 'lockboxkeys', after[; Take: give lbKeys ~concealed; !once the keys are taken unconceal them lbKeysTaken = 1; "You read a message saying you have taken the lock box keys.";], before[; look, take, examine, search: if (SeelbKeys == 0) { "You're not supposed to know about the lock box keys yet because you haven't 'discovered' them with the awkward command system."; }], has pluralname concealed; Room ThirdRoom "Third Room" !Third room the player reaches with Description [; if (flashlight in player) { "The description tells you that the room is pitch black, but you are able to see with the aid of the flashlight you picked up. It explains how there is no danger to be seen, and goes on to describe a button at the center of the room."; } else { "The description reads that it is currently pitch black. It also mentions that you are likely to be eaten by a grue. This is probably one of those lame instant death things, so just go back the way you came and look for another item."; }], w_to SecondRoom, cant_go [; if (flashlight in player) { "You read a frustrating message that says you can't go that way."; } else { deadflag=1; "A statment prints on the screen telling you that you have been eaten by a grue."; }]; Furniture button "Button" ThirdRoom !It is a button with Description [;if (flashlight in player) { "Text explains what the button looks like."; } else { deadflag = 1; "A statment prints on the screen telling you that you have been eaten by a grue."; }], name 'button', before [; push: if (flashlight in player) { deadflag = 2; "You read the following text: "; } else { deadflag = 1; "A statment prints on the screen telling you that you have been eaten by a grue."; }];