! ---------------------------------------------------------------------------- ! Game Description and Story Line ! ---------------------------------------------------------------------------- Constant Story "Silicon Quest^"; Constant Headline "An interactive fiction game by Nidal Bazzi ^^ ^Story Line:^ -----------^ ^Most of the inhabitable planets in the galaxy are now colonized by humans. All countries on Earth have been united into one super power in competition with other planetary powers. Wars have now ceased on earth but continue on other indepandant planets either in the form of civil wars or inter-planetary wars. Earth is prosperous but its natural resources are now scarce. Solar power has become the Major source of energy but solar panels are made out silicon which has become the most precious and scarce metal on earch Luckily, the planet Silica is very rich in this precious metal but it is controlled by another developing power. Earth law prohibits waging war on other planets except in self defense but there is no law against covert operations on other planets.^^ You are the leader of a unit in the in the Intelligence Covert Operations (ICO). Your mission is to find and establish a puppet regime in Silica that will cooperate with your government to ~import~ cheap Silicon.^"; Constant Debug; ! ---------------------------------------------------------------------------- ! These are the libraries that are referenced by the compiler. ! ---------------------------------------------------------------------------- Include "parser"; Include "verblib"; Include "Grammar"; ! ---------------------------------------------------------------------------- ! Initialization ! ---------------------------------------------------------------------------- [ Initialise; print "^^^^^Welcome to Silicon Quest!^^"; give your_office light; move space_ship to roof_top; location = your_office; ]; ! Global attribute used in the embassy object ! the timeToTalk attribute is used to check if player can talk to the general ! this attribute is only activated if the general is in the embassy ! as a result of Joseph inviting him and Randa is present Attribute timeToTalk; ! the generalInvited attribute is given to the general when he is invited by ! Joseph Attribute generalInvited; ! the Pwd1Found and Pwd2Found attributes are given to the player when he/she enters the ! right password to fly the ship ! Pwd1Found is used by the parsing routine and reset each time ! Pwd1Found is to fly from planet Earth ! Pwd2Found is to fly from planet Silica Attribute PwdFound; Attribute Pwd1Found; Attribute Pwd2Found; ! ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ! Rooms and objects ! ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ! Object earth "The Earth" with name "earth" "Earth" "our planet" "home" "my planet", description "Earth, beautiful sweet home, in dire need of Silicon.", has ~light; ! ----------------------------------------------------------------------------------------------------------------- ! headquarters object !------------------------------------------------------------------------------------------------------------------ Object headquarters "intellignece operations headquarters" has ~light, with name "headquarters" "special ops" "hq" , description "Special Operations Headquarters" ; ! ----------------------------------------------------------------------------------------------------------------- ! your office object (the players's office) !------------------------------------------------------------------------------------------------------------------ ! Object your_office "your office" with name "office" "my office" "your office" "hq" "work" "desk", initial "^You have two assistants: Randa and Joseph.", description "^Allowed directions from here are: ^east, west (the offices of your assistants) and up (the roof)., your safe is behind you", e_to randa_office, w_to joseph_office, s_to safe, u_to roof_top, has light; ! ----------------------------------------------------------------------------------------------------------------- ! safe object this object holds a note with the two passwords needed to fly the space ship !------------------------------------------------------------------------------------------------------------------ Object safe "safe" with name "safe" "closet" "lock box", close, description "a safe in the middle of the wall where you keep your confidential documents", before [; Open, Unlock: if (safe has open) { print "^Safe is already open"; rtrue; } print "^there is a note with the numbers 982 and 581 on it."; give safe open; rtrue; ], n_to your_office , when_open "safe is open.", when_closed "safe is a closed.", has static light container openable; ! ----------------------------------------------------------------------------------------------------------------- ! randa_office object !------------------------------------------------------------------------------------------------------------------ Object randa_office "Randa's Office" has light static, with name "randa^s" "her office" , description "^You are in Randa's office.", before [; Take, Bring: if (a_agent notin player) { move a_agent to player; "^Randa is happy to be assigned to a new mission"; } "^She's already been assigned to come with you"; drop: if (a_agent notin randa_office) { move a_agent to randa_office; "Randa is disappointed but you assure her you will need her later"; } "^She's already at her office"; ], w_to your_office; ! ----------------------------------------------------------------------------------------------------------------- ! joseph's office object !------------------------------------------------------------------------------------------------------------------ Object joseph_office "Joseph's Office" has light static, with name "joseph^s" "his office" , initial "^You are in Joseph's office. Joseph is a multicultural person and has many connections with ^Silican's government officials. if you bring him with you he'll be valuable", description "^You are in your assistant Joseph's office. ", before [; bring, take: if (j_agent notin player) { move j_agent to player; "Joseph is anxious with this new assignment he can't wait till he gets to Silica"; } "^Joseph is already commited to your mission"; drop: if (j_agent notin player) { move j_agent to joseph_office; "You tell Joseph to stay at the office and wait for your instructions."; } "^Joseph is already at his office"; ], e_to your_office; ! ----------------------------------------------------------------------------------------------------------------- ! a_agent is the attractive female covert agent Randa !------------------------------------------------------------------------------------------------------------------ Object a_agent "sociable beautiful agent" randa_office has animate female talkable, with name "beautiful agent" "attractive" "beauty" "agent" "Randa" "sociable" "her", initial "^Randa is an attractive and sociable woman and has excellent skills with getting people ^to spill their gutts. ^if you bring her with you she might get the right person to talk.", life [; "^Randa is one of your best special agents"; ]; ! ----------------------------------------------------------------------------------------------------------------- ! j_agent is the bilingual agent that speaks many language !------------------------------------------------------------------------------------------------------------------ Object j_agent "connections agent" joseph_office has animate male talkable, with name "bilingual agent" "bilingual" "social" "agent" "joseph" "joe" "him", description "^Joseph has talent for inviting the right people for the right occasions.", life [; drop: if (j_agent notin player) { move j_agent to joseph_office; "You tell Joseph to stay at the office and wait for your instructions."; } "^Joseph is already at his office"; ]; ! ----------------------------------------------------------------------------------------------------------------- ! Space Ship object ! ----------------------------------------------------------------------------------------------------------------- !================================================================ !------- passwords needed to fly the space ship !------- password1 is needed to fly from planet Earth !------- password2 is needed to fly from planet Silica Array password1 string "581"; Array password2 string "982"; !--------Global function used to check if the password is correct [ParsePwd str pwd i; if(str->1 ~= pwd->0) return 0; for (i = 1: i <= str->1: i++ ) { if( str->(i+1) ~= pwd->i ) return 0; } return 1; ]; !================================================================ !--------Global function used to input the pwd [GetPwd pwd buffer; print "^Enter password ^... "; LTI_Insert(0, 60); ! the following statement produces programming error. it was replaced by the above line !buffer->0 = 60; read buffer 60; if( ParsePwd(buffer, pwd) == 0 ) { give player ~PwdFound; "^Wrong Password! Can not activate the ship and fly without the password!^"; } give player PwdFound; "^Correct Password..... the space ship starts flying!^"; ]; !================================================================ !--------Global function to print flying to Earth message [printFlyingToEarth; move space_ship to roof_top; "Earth sweet home, here we go"; ]; !--------Global function to print flying to Earth message [printFlyingToSilica; move space_ship to landing_site; "Fasten your seat belt, planet Silica here we come"; ]; ! ----------------------------------------------------------------------------------------------------------------- ! roof top (the roof of the headquarters) ! ----------------------------------------------------------------------------------------------------------------- ! Object roof_top "Earth's headquarters roof top" with name "roof top" "top" "roof" with description "^this roof looks like a launching pad for space travel. Just in front of you see a huge space ship.", in_to space_ship, d_to your_office, has light; !===================================================================================================== Object space_ship "space ship" with name "space ship" "rocket" "vehicle" "space vehicle" "ship", description "a space ship that is huge and built for traveling to planets outside the solar system", before [; Lock, Unlock, Close, Open: "Why do you want to do that?"; Take: "The ship is too heavy, with your age, you will hurt yourself."; Enter, Climb: move player to space_ship; "^This ship flies extremely fast. It will get to planet Silica in no time."; drop: if (noun == j_agent && j_agent in player) { move j_agent to joseph_office; "You tell Joseph to stay back at the office and wait for your instructions."; } else if (noun == a_agent && a_agent in player) { move a_agent to randa_office; "You tell Randa to stay on Earth but you promise to come back for her if you need her."; } else { "You have nothing to drop, hopefully you don't mean drop the ship."; } return 1; Fly: !Space ship can't hold more than two people. if (a_agent in player && j_agent in player) { "^Sorry!!! This ship holds only two people. ^You'll have to drop somebody"; } ! --- get a password code from the user to fly the ship ! --- the password is one of the 2 numbers read on a note in the player's office safe else if (space_ship in roof_top && player has Pwd1Found) { print "^debugging flying to silica"; printFlyingToSilica(); } else if (space_ship in landing_site && player has Pwd2Found) { printFlyingToEarth(); } else if (space_ship in roof_top) { !get password on Earth GetPwd(password1); if(player has PwdFound) { ! Earth password found. This is done only once in the course of the game give player Pwd1Found; !reset the PwdFound Attribute so the next time GetPwd is called when on Silica !it will not be already set if the user enter the wrong password there give player ~PwdFound; printFlyingToSilica(); } else { "^Wonder where I can read that password. I must have missed something at the office"; } } else { !get password on Silica GetPwd(password2); if (player has PwdFound) { ! No need to reset PwdFound now because both passwords are now found ! Silica password found. This is done only once in the course of the game give player Pwd2Found; printFlyingToEarth(); } else { "^Wonder where I read that password"; } } return 1; ], out_to [; if (space_ship in roof_top) { give earth light; return roof_top; } else { give silica light; return landing_site; } ], has static light enterable container open; ! ----------------------------------------------------------------------------------------------------------------- ! the other planet ! ----------------------------------------------------------------------------------------------------------------- ! Object silica "planet Silica" with name "planet" "silica", initial "this planet is ruled by a weak and shaky democracy but it had a history of military coups by zealot generals who are hungry for power.", description "Silica is very rich in the natural resource Silicon. Earth is in dire need for this source" has supporter static light; ! ----------------------------------------------------------------------------------------------------------------- ! object Landing site ! ----------------------------------------------------------------------------------------------------------------- ! Object landing_site "Silica's landing site" with description "^a landing site in Silica for Earth visitors. ^To the north there are a couple of armed uniformed guards in front of a ^fenced building that has a design that is similiar to those on earth. ^A sign on its front reads ~Earth Embassy~", n_to embassy, in_to space_ship, has light static supporter; ! ----------------------------------------------------------------------------------------------------------------- ! embassy object (this is the earth embassy) !------------------------------------------------------------------------------------------------------------------ ! Object embassy "embassy" with name "embassy" "earth embassy" "safe haven", description [; if (embassy hasnt visited) { "^inside the embassy there is a huge hallway with thick plush blue carpeting. ^It is brightly lit with large elegant chandlier. to the right, a sign that reads ^~Dinner party tonight for Silicon government and military officials~."; } else { print "Back at the embassy. Nothing to do here but socialize"; } ], before [; Invite: if (j_agent in player && GenMan hasnt generalInvited) { ! now the general is invited and can be talked to by the player if ! Randa is present give GenMan generalInvited; "Joseph did a magnificant job of inviting General Nattan to the party. ^Nothing to do but waste time looking around. ^~wait~ing is the best and only option now"; } else if (GenMan has generalInvited) { "^Nobody else to invited "; } "Joseph can sure be helpful now by inviting somebody important ^like a president or a general"; wait: if (GenMan has generalInvited) { StartDaemon(you_are_waiting); } bribe: if (GenMan in embassy && a_agent in player && embassy has timeToTalk) { print "^Bingo, Randa did it again! She convinced the general to take over the government."; print "^Congratulations. !!!!!!!!!!!! Game is Over !!!!!!!!!!!!!!!!"; PlayerTo (game_over); } Talkto, Talk, Ask: if (GenMan in embassy && a_agent in player && embassy has timeToTalk) { print "^Bingo, Randa did it again! She convinced the general to take over the government."; print "^Congratulations. !!!!!!!!!!!! Game is Over !!!!!!!!!!!!!!!!"; PlayerTo (game_over); } else if (j_agent notin player && GenMan notin embassy) { "^Somebody with connections would be helpful now to invite the right powerful people"; } else if (a_agent in player && GenMan notin embassy) { "^Randa can't help me at this time"; } else if (j_agent in player && GenMan notin embassy && GenMan hasnt generalInvited) { "^Joseph should invite somebody important to the party"; } else if (a_agent notin player && GenMan in embassy) { "^Randa is the only one who can bribe General Nattan to finish this mission"; } else if (GenMan notin embassy && GenMan has generalInvited) { "^~wait~ing is the best and only option now"; } "^But, at this time talking will not accomplish anything"; Kick, Attack, Blast, Kill: print "^A gentelman uses more intelligent methods on foreign soil"; if (GenMan in embassy && a_agent in player && embassy has timeToTalk) { "^talking to the General would sure help now"; } else if (GenMan notin embassy) { "^Wish someone with connections invite important people to the party"; } Shoot, Bomb: "You are not very diplomatic, are you. Maybe you're not the right person for this"; ], s_to landing_site, has light scenery static; ! ----------------------------------------------------------------------------------------------------------------- ! object used to start a timer that will expires at any turn the user will make to talk to the military general !------------------------------------------------------------------------------------------------------------------ ! Object you_are_waiting "you_are_waiting" with name "waiting", description "", daemon [; StartTimer(wait_timer, 0); ]; ! ----------------------------------------------------------------------------------------------------------------- ! object used to stop the daemon and timer !------------------------------------------------------------------------------------------------------------------ ! Object wait_timer with time_left 0, time_out [; StopDaemon(you_are_waiting); StopTimer(wait_timer); print "^The party starts. General Nattan walks in. He is a very powerful and a popular general in the Silica armed forces."; print "^An urgent question comes to mind !!! ^what if you ask Randa to talk to General Nattan"; give embassy timeToTalk; move GenMan to embassy; PlayerTo(embassy); ]; ! ----------------------------------------------------------------------------------------------------------------- ! object General Nattan !------------------------------------------------------------------------------------------------------------------ ! Object GenMan "General Nattan" silica has animate male talkable concealed, with name "General" "Nattan" "Military Leader", description "", life [; Talkto, Talk, Ask: if (GenMan in embassy && a_agent in player && embassy has timeToTalk) { print "Bingo, Randa did it again! She convinced the general to take over the government. ^Congratulations. !!!!!!!!!!!! Game is Over !!!!!!!!!!!!!!!!"; PlayerTo (game_over); } ]; ! ----------------------------------------------------------------------------------------------------------------- ! object used signal game is over !------------------------------------------------------------------------------------------------------------------ ! Object game_over "game_over" with name "game is over", description "^^^!!!!!!!!!!!!!!!!!!Thank you for playing Silicon Quest!!!!!!!!!!!!!!!!!!!", has light; ! ---------------------------------------------------------------------------- ! New verbs (to add to the library stock) ! ---------------------------------------------------------------------------- [SendSub; "can't be sent there";]; [FlySub; if (space_ship hasnt player) { print "^Sorry, but you are not a bird. You need some kind of a machine to do that"; rtrue; } else { print "^and what do you want to fly?"; rtrue; } ]; [FlytoSub; if (noun ~= silica) "You need a space ship for that"; ]; [TalkSub; "There is no one here to talk to, so you talk to yourself for several minutes and feel better."; ]; [bringSub; "Sorry can't bring that on such a mission";]; [bribeSub; "Isn't that illegal?";]; [blastSub; "Be more diplomatic";]; [KillSub; "That's against the law on any planet";]; [BombSub; "It is a good thing you are not the president";]; [ShootSub; "Even if you're ICO, you shouldn't do that";]; [TalkToSub; "The right person to do that is not here";]; [KickSub; "That is not the civilized thing to do for an intelligent leader like you";]; [InviteSub; "Only Joseph can invite the right people";]; ! ---------------------------------------------------------------------------- ! This section includes new verbs added. ! ---------------------------------------------------------------------------- Verb "send" * noun ->Send; Verb "fly" * noun ->Fly * "to" "silica" ->Flyto; Verb "bribe" * noun ->bribe; Verb "travel" * ->Fly * noun ->Fly * "to" noun ->Flyto; Verb "blast" * ->Fly * noun ->Fly * "into" noun ->Fly * "to" noun ->Fly * "out" "of" "here" ->Fly; Verb "bring" * ->bring * noun ->bring; Verb "talk" * ->Talk * "to" noun ->Talk * "with" noun ->Talk * noun ->Talk; Verb "socialize" * -> Talk * "with" noun -> Talk; Verb "invite" * ->Invite * "general" "to" "the" "party" ->Invite * "general" ->Invite * noun ->Invite; Verb "Kick" "Kill" = "attack"; Verb "shoot" "bomb" = "blow"; ! ---------------------------------------------------------------------------- ! This section includes extensions to the standard grammar library. ! ---------------------------------------------------------------------------- Extend "speak" * "to" noun -> Talk * "with" noun -> Talk * noun -> Talk; Extend "take" replace * ->bring * noun ->bring; END