! ! Inform test game ! Constant MAX_SCORE = 50; ! Global hunger = 10; Include "Parser"; Include "VerbLib"; Object cluster "Athena cluster" with description "You are in an Athena cluster. \ A nest is to your southwest. ", sw_to Google has light; Nearby workstation "Mac OS X Powerbook" with name "computer" "workstation" "machine" "powerbook" "slot", description "The Powerbook has a Unix prompt and a slot in the top.", before [; Take, Push, Pull: "The computer is chained to the desk."; ], after [; Insert: "inserted!"; ], has static container open openable; Object Google "The Google Nest" with description "A brightly-colored nest with many shiny objects.", ne_to cluster has light; Nearby interpreter "Z-machine interpreter" with name "z-machine" "interpreter", description "The interpreter has a label reading ~Frotz~ on it.", after [; Take: "The interpreter hums quietly as you slip it into your pocket."; Insert: if (noun == interpreter && second == workstation) { move interpreter to workstation; score = score + 5; "^The interpreter disappears into the slot.^^\ The Powerbook displays the message ~Installing the Z-machine interpreter~.^\ It can now play adventure games.^"; } ]; Nearby zork "Zork adventure game" with name "zork" "game", description "The Zork game is labeled ~zork.z5~", after [; Take: "The game bleeps happily as you slip it into your pocket."; ], before [; Insert: if (noun == zork && second == workstation) { if (interpreter in workstation) { move zork to workstation; score = score + 10; "^Zork disappears into the slot.^^\ The Powerbook begins playing Zork.^"; } else { ! Dangling else "^The Powerbook speaks, saying,^ \ ~I don't know what to do with that file. \ Maybe an interpreter would help?~^"; } } ]; Nearby inform "Inform compiler" with name "inform" "compiler", description "The compiler has a label reading ~Inform~ on it.", after [; Take: "The compiler burps aggressively as you slip it into your pocket."; ], before [; Insert: if (noun == inform && second == workstation) { move inform to workstation; score = score + 5; "^The compiler disappears into the slot.^^\ The Powerbook displays the message ~Installing the compiler~.^\ It can now compile story files into adventure games.^"; } ]; Nearby storyfile "Story" with name "story" "foo", description "The story tells a tale of knights, princesses, and dragons. But you can't play it yet.", after [; Take: "The story whistles a merry tune as you slip it into your pocket."; ], before [; Insert: if (noun == storyfile && second == workstation) { if (inform in workstation) { move storyfile to workstation; score = score + 10; "^^The story disappears into the slot. Inform reads in the story^\ and converts it into a game that you might like to play.^"; } else { "^The Powerbook speaks, saying, ^ \ ~I don't know what to do with that file. \ Maybe a compiler would help?~^"; } } ]; [ PlaySub; if (noun == workstation) "^A computer is not a toy. Perhaps you're looking for a game?^"; if (noun == player) "^It's very lonely playing with oneself.^"; if (noun == zork) { if (zork in workstation) { "^The computer is busy playing Zork. Perhaps you should find your own game.^"; } else { "^You have to load it into the computer first.^"; } } if (noun == storyfile) { if (storyfile in workstation) { score = score + 20; print "^^You installed the interpreter and the compiler, and then compiled and played a game.^"; print "^^ You've won!^^"; quit; } else { "^You have to load it into the computer first.^"; } } "^Very mischievous of you, but you can't play that.^"; ]; [ Message; "^^^^ MAS.490 instructions for text adventures^^^^"; ]; [ Initialise; Message(); location = cluster; "^^It's early Thursday morning and your adventure game \ is due in a few hours.^You head to the Athena cluster...^^"; ]; Include "Grammar"; Verb 'play' * noun -> Play; end;