// PNFG // Game: Return to Zork (Infocom 1993) // Task: 01 // Description: Getting to West Shanbar // Notes: The task is represented from BradyGames' strategy guide. // It has been simplified: // 1-Removed NPC interaction // 2-Not considering "optional" commands, except for drop // Comments: 1- Have some room-specific commands be actually defined inside the room construct. // 2-Define a default output for each action globally, then refine when applicable in // rooms...should save a lot of copy-pasting. I'm trying that here. // Missing: 1-Complex interacts with NPC // 2-Taking pitures, playing radio... commands = { //defined in rooms n,s,e,w,cut,dig,throw,talk,tie,ride,look,examine, //globally defined take,drop,quit //Note, we first define all movements (n,s,e,w) globally as invalid //We will refine in particular rooms } //OBJECTS object vulture{ state {aggro0,aggro1,aggro2} } object rock { } object plant { state {live,dead} } object knife { } object vines { } object planks { } object raft { } stuff = { rock, knife, vines, planks } places = { mountainpass, signpost, lighthousefront, lighthouseinside, lighthouseback, lighthousebalcony, roadtosouth } room you { } room mountainpass { enter{ "You are now on the Mountain Pass"; } (you,look) { "You are at the mountain pass."; "You see a signpost (examine) and a trail to the south."; "You will need to get closer to the sign in order to read it."; if (mountainpass contains vulture){ "There is a vulture on top of the sign."; } } (you,talk,vulture) { if (mountainpass contains vulture) { "Kwaah, Kwaah."; } } (you,examine) { "You get closer to the sign."; move you from mountainpass to signpost; } (you,throw,rock) { if (you contains rock) { move rock from you to offscreen; if (mountainpass contains vulture){ "You hit the vulture, it flies away"; move vulture from mountainpass to offscreen; } else { "Nice throw...You lose sight of the rock"; } } } (you,s) { move you from mountainpass to lighthousefront; } } room signpost { (you,look){ "The sign reads 'Welcome to valley of Vultures.'"; if (signpost contains plant){ "There is a plant next to the sign's base."; } if (mountainpass contains vulture){ "The vulture is looking at you straight in the eyes."; } } (you,take,plant){ if (signpost contains plant) { "The plant won't budge."; if (mountainpass contains vulture){ if (vulture.aggro0) { -vulture.aggro0; +vulture.aggro1; } else { if (vulture.aggro1) { -vulture.aggro1; +vulture.aggro2; } else { if (vulture.aggro2) { "You were killed by the vulture."; +game.lose; } } } } } } (you,cut,plant){ if (signpost contains plant) { if ( you contains knife ){ if ( mountainpass contains vulture ){ "You were killed by the vulture."; +game.lose; } else { move plant from signpost to you; -plant.live; +plant.dead; "You cut the plant with your knife and pick it up."; } } else { "You don't have anything to cut the plant."; } } } (you,dig,plant){ if (signpost contains plant) { if ( you contains knife ){ if( mountainpass contains vulture ){ "You were killed by the vulture."; +game.lose; } else { move plant from signpost to you; "You dig up the plant with your knife."; "You pick it up and leave it in in some soil."; } } else { "You don't have anything to dig the plant."; } } } (you,n){ move you from signpost to mountainpass; } } room lighthousefront{ enter{ "You are now in front of the Lighthouse"; } (you,look){ "You see a light house."; "You can go behind the lighthouse (East)."; "You can use the road to the south (South)."; "You can go to the mountain pass (North)."; "You can enter the lighthouse (West)."; } (you,n){ move you from lighthousefront to mountainpass; } (you,e){ move you from lighthousefront to lighthouseback; } (you,w){ move you from lighthousefront to lighthouseinside; } (you,s){ move you from lighthousefront to roadtosouth; } } room lighthouseinside{ enter{ "You are now inside the Lighthouse"; } (you,look){ "You are inside the light house."; "You can go back outside (South)."; "You can go to the balcony (North)."; } (you,s){ move you from lighthouseinside to lighthousefront; } (you,n){ move you from lighthouseinside to lighthousebalcony; } } room lighthousebalcony{ enter{ "You are now on the Lighthouse balcony"; } (you,look){ "You see the magnificient view."; "You can go inside the lighthouse (South)."; } (you,s){ move you from lighthousebalcony to lighthouseinside; } } room lighthouseback{ enter{ "You are now behind the Lighthouse"; } (you,look){ "You see the river"; "You can go to front of the light house (North)."; if (lighthouseback contains planks){ "You see a bunch of wood planks."; } if (lighthouseback contains vines){ "Vines are growing on the lighthouse."; } if (lighthouseback contains raft){ "You see a raft lying about..."; } } (you,cut,vines){ if (lighthouseback contains vines && you contains knife) { "You cut the vines and pick them up."; move vines from lighthouseback to you; } } (you,tie,vines){ if (you contains vines && lighthouseback contains planks) { "You tie the vines to the planks."; "You've just built a raft."; move vines from you to offscreen; move planks from lighthouseback to offscreen; move raft from offscreen to lighthouseback; } } (you,ride,raft){ if (lighthouseback contains raft) { "You ride the raft to West Shanbar"; +game.win; } } (you,n){ move you from lighthouseback to lighthousefront; } } room roadtosouth{ enter{ "You move to the Road to the South"; } (you,look){ "You can venture in the dark woods (South)."; "You can go to the light house (North)."; } (you,s){ "You are ambushed and killed by grues."; +game.lose; } (you,n){ move you from roadtosouth to lighthousefront; } } (you,take,stuff $s) { places $p; if ($p contains $s && $p contains you) { move $s from $p to you; "You pick up the ${s}."; } else { "There is no ${s} here."; } } (you,drop,stuff $s) { places $p; if (you contains $s && $p contains you) { move $s from you to $p; "You drop the ${s}."; } else { "You don't have the ${s}."; } } (you,help) { "n,s,e,w,cut,dig,throw,talk,tie,ride,look,examine"; "take,drop,quit"; } (you,quit) { "Good bye"; +game.lose; } start { " -= Return to =-"; "********* ******* ******** *** ***"; "********* ********* ********* *** ***"; " *** *** *** *** *** *** ***"; " *** *** *** *** *** ******"; " *** *** *** ********* *****"; " *** *** *** ******** *****"; " *** *** *** *** *** ******"; " *** *** *** *** *** *** ***"; "********* ********* *** *** *** ***"; "********* ******* *** *** *** ***"; "Type help for list of commands"; " "; +vulture.aggro0; +plant.live; "You are now on the Mountain Pass"; move you from offscreen to mountainpass; move knife from offscreen to you; move plant from offscreen to signpost; move rock from offscreen to mountainpass; move vulture from offscreen to mountainpass; move vines from offscreen to lighthouseback; move planks from offscreen to lighthouseback; }