!Game Wonder House !Project 2 ----Cis 587 !by Ali Darwiche !----------------------------------------------------- !----------------------------------------------------- Constant Story " ********WONDER HOUSE*******"; Constant Headline "^^^An interactive Game^by Ali Darwiche.^^"; Constant DEBUG; Constant MAX_SCORE=100; Include "parser"; Include "Verblib"; Include "Grammar"; Attribute legible; !for letter to read !------------------------------------------------------ !------------------------------------------------------ !Initialise !------------------------------------------------------ [Initialise; location = Front_House; print "^^^^It is just like a dream, after a long journey you find your self here, infront of this old house. Just pretend every thing is OK, and start your adventure.^^"; ]; !------------------------------------------------------- !functions [ ReadSub; <>; ]; [ TearSub; "You can't tear that";]; !------------------------------------------------------- !routine to run away from confusion in multipe entry !the same room. [ Inside x y; do { x = parent(x); } until (x==0 or y); if (x==0) rfalse; ]; !===================================================== !----------------------------------------------------- !Front_House !----------------------------------------------------- Object Front_House "front house" has light with name "front" "front porch" "entry", description "In the middle of no where, you're standing alone infront of an old house. You see an old ladder lying between a rock and a huge tree. You are looking and wondering what to do!", in_to Foyer, n_to Foyer, !code to insure propre get off exit and out before [; if (player notin hugetree) rfalse; Exit, Go: if(noun == d_obj or out_obj) "This is not the way to get down from the tree!"; !to ensure physical reachable from the another place Examine, Enter, ThrowAt, ThrownAt: ; default: if (inp1 ~= 1 && noun ~= 0 && Inside(noun,hugetree) == 0) "you can't reach", (the) noun, " from up here."; if (inp2 ~= 1 && second ~=0 && Inside(second,hugetree) == 0) "You can't reach ", (the) second, " from up here."; ]; !---------------------------------------------------- ! object hugerock !---------------------------------------------------- Object rock "rock" Front_House has concealed static supporter enterable !general if you have found the blue gem under it with name "large rock" "boulder" "rock", description "It is a nice an confy looking rock to sit on it after long journey.", before [; Take: "the rock is much too large and heavy for you to carry."; Push, Pull: "But the rock belongs here infront of the house!!!"; LookUnder: if (player in hugetree || player in ladder) "You are unable to reach the rock from here."; if (player in self) "You try and try then you realize you are on top of the rock!"; if(self hasnt general) { give self general; move blue_gem to player; score=score + 15; "you just found a beautiful blue gem stone!!!"; } ]; !---------------------------------------------------- !the blue gem !---------------------------------------------------- Object blue_gem "blue gem" with name "blue" "gem" "stone", description "it is beautiful and vivid."; !----------------------------------------------------- !object ladder !----------------------------------------------------- Object ladder "ladder" Front_House has static concealed supporter enterable !general if it is by hugetree with name "ladder" "stairs" "post", description "It is an old and tall ladder!", before [; Push, Pull: if(player notin Front_House) "You'll have to get off the, (the)parent(player), first."; if(self has general) { score = score - 5; give self ~general; "You pushed the ladder away from the tree."; } give self general; score=score + 5; "You pushed the ladder over the tree"; Climb,Enter: if (self has general) { move player to ladder; "You jump onto the ladder."; } if (self hasnt general) { "oooch the ladder has nothing to lean on...you cannot do that!.."; } ]; !------------------------------------------------------ !object hugetree ! !------------------------------------------------------ Object hugetree "hugetree" Front_House has concealed supporter enterable static with name "tree" "large" "largetree" "hugetree", description "It is tall and high, but strong and steady", before [; Enter, Climb: if (player notin ladder) "The tree is much too high to climb"; if( ladder hasnt general) "You can't reach the tree from here!."; if (player in ladder && self hasnt general) { give self general; move green_gem to player; move player to hugetree; score = score + 20; " you are in the tree and you found the green gem congratulations!"; } ]; !---------------------------------------------------- !the green gem !---------------------------------------------------- Object green_gem "green gem" hugetree with name "green" "greengem", description "it is beautiful and vivid."; !-------------------------------------------------- !========================================== Object Foyer "foyer" with name "foyer" "entry", description "you are in the foyer now,the ceiling is high. It is very hard not to notice that old an confrotable chair by the cabinet and not to hear that loud parrot in his cage.^^", out_to Front_House, s_to Front_House, e_to hallway, has light; !========================================= Object cage "cage" Foyer with name "cage" "prison" "parrot house", description "^It is the house of an old parrot. It is rusty an dirty!!!!!!.", before[; !special function, to open the cage since the parrot !is supposed to be in it at the intitial state. Open: if (parrot in cage) { StartDaemon(parrot); move parrot to player; score = score + 20; give cage open; print "~Hello! I am the parrot of the house, it is about time I am out of this cage, what are you doing in here? do you think you are some big adventurer or something??? Pelllllease!~.^ then he jumps over your shoulder and he never shots up!"; rtrue; } ], when_open "There is an open cage here.", when_closed "there is a closed cage here.", has static container openable; !==================================================== !the parrot object ! object -> -> parrot "good size and colorful parrot" with name "parrot" "bird" "talking bird", description "He is little talking machine, he randomly says different things, use your judjement in trusting him!!!!!.", before [; Drop, Insert: if (second == rusty_chair) { print "You dropped the parrot onto the couch, and he is losing it little by little, his voice is down , and he is speaking slowly an."; rtrue; } print "~Hey! I am not going anywhere without you!~, parrot says.^"; rtrue; ], !the bird is randomly saying things about the cahir and !other hidding things in the house ! daemon [; switch (random(5)) { 1: "The parrot says: ~Go and sit in that chair in the middle ofthe room.....~"; 2: "The Parrot says: ~I like you man...~"; 3: "The Parrot says: ~Ckeck under the cabinet......~"; 4: "The parrot says: ~do not drop me in the chair.....~"; } ], has animate; !======================================================= !object rusty chair ! object rusty_chair "chair" Foyer with name "chair" "armchair", when_open "There is a filthy, rusty and worn chair here", before [; Enter: deadflag=1; "You are in slow death, hoop you did not listen to the Parrot."; !anything sits on the chair has to be killed so we ahve !to set the property of receive Receive: remove noun; "The chair kills", (the) noun, "and hides it away."; ], has static container open enterable; !===================================================== !object the cabinet ! Object cabinet "cabinet" Foyer with name "cabinet" "closet", before [; Open: if (red_gem in cabinet) { move red_gem to player; score = score + 10; give cabinet open; print "~You found an very nice and rich looking stone.....~"; rtrue; } ], when_open "There is an open cabinet here.", when_closed "There is a closed cabinet her.", has static container openable; !==================================================== !object red gem Object -> -> red_gem "red gem" with name "red" "red stone" "red gem", description "It is a vivid and colorful gem."; !====================================================== !----------------------------------------------------- Object hallway "hallway" with name "hallway" "passage", description "It is an empty hallway except for the marble table against the south wall.....!", e_to great_room, w_to Foyer, has light; !------------------------------------------------------ Object marble_table "marble table" hallway has concealed static enterable supporter with name "marble" "marble table" "table" "counter", !general, player found the letter description "It is green marble table very old , and it has under it an old forgotten letter!......", before [; Take,Pull, Push: "But the table is bolted to the wall!!!."; LookUnder: if (self hasnt general){ give self general; score = score + 10; move letter to player; "You got the letter!!!!!!."; } ]; !------------------------------------------------------ !object letter !------------------------------------------------------- object -> -> letter "letter" with name "letter" "papper", descritption "The letter contain a beneficial note.", before [; Consult, Read: "Check out the box in the other room"; Tear: remove letter; "You rip the letter into tiny pieces that blow away in the wind."; ] has legible; !------------------------------------------------------------------ !----------------------------------------------------- !object great_room !----------------------------------------------------- Object great_room with name "great" "great room" "large room", description "The light is dime, the room smells funny, on the floor you see an old wood box and against the wall you see a large closet.", w_to hallway, has light; !------------------------------------------------------ Object box "box" great_room with name "box" "crate" "wood box", description "It is closed brown old and ratten box", before[; !special function, to open the box since the old letter !is supposed to be in it at the intitial state. Open: if (old_letter in box) { move old_letter to player; score = score + 10; give box open; print "now you got the letter"; rtrue; } ], when_open "There is an open box here.", when_closed "there is a closed box here.", has static container openable; !==================================================== object -> -> old_letter "old letter" with name "letter" "papper" "old letter", descritption "The letter contain a note.", before [; Consult, Read: "Check under the closet"; Tear: remove old_letter; "You rip the old letter into tiny pieces that blow away in the wind."; ] has legible; !------------------------------------------------------- !------------------------------------------------------- !object the closet ! Object closet "closet" great_room with name "cabinet" "closet", before [; Open: if (diamond in closet) { move diamond to player; score = score + 20; give closet open; print "~You found an very nice and clear diamond.....~"; rtrue; } ], when_open "There is an open closet here.", when_closed "There is a closed closet her.", has static container openable; !================================================== !---------------------------------------------------- !the diamond !---------------------------------------------------- Object diamond "diamond" great_room with name "clear" "diamond" "dia", description "it is beautiful and clear."; !-------------------------------------------------- !========================================== !Grammar Extend "read" first * legible -> Read; Verb "tear" * noun -> Tear; !=====================================================