!============================================================================= ! A conversion from the original MiniAdventure source. Constant Story "House by Jon Ripley (C) 1995"; Constant Headline "^^House. You must explore the house and find the treasure...But first you'd better get a snack, your favourite teddy and a cushion to sit on. Good Luck!^^A conversion from the original MiniAdventure source.^^"; Serial "050130"; Release 1; ! Constant NO_HEALTH; Constant MAX_SCORE = 70; Include "Parser"; Include "VerbLib"; Global Strength = 100; !============================================================================= ! Object classes Class Room has light; Class Connector with before [; Examine: print "The door is currently "; if (self has open) print "open"; else print "closed"; if (self has locked) print " and locked"; "."; ], has lockable locked openable door static scenery; Class Treasure with treasurepoints 0, after [; Take: score=score+self.treasurepoints; Drop: score=score-self.treasurepoints; ]; Class Hazard with hazardpoints 10, before [; Take,Pull,Push,PushDir: Strength=Strength-self.hazardpoints; print "Ouch! That hurt.^"; #Ifndef NO_HEALTH; if ( Strength <= 0) GameOver(3); #Endif; ! NO_HEALTH rtrue; default: "Careful - ", (the) self, " looks dangerous."; ], has static; Class Prop with before [; Take,Pull,Push,PushDir: print_ret (The) self, " is fixed in place."; default: "You don't need to worry about ", (the) self, "."; ], has static; !============================================================================= ! Game locations Room master_bedroom "Master Bedroom" with description "You are in the master bedroom. Exits lead south and east.", s_to walk_in_wardrobe, e_to upstairs_hallway; Prop -> double_bed "double bed" with description "double bed", name 'double' 'bed', has static; !============================================================================= Room upstairs_hallway "Upstairs Hallway" with description "You are in a cramped hallway. There are exits north, south, east and west.", n_to bathroom, s_to top_of_stairs, e_to childrens_bedroom, w_to master_bedroom; !============================================================================= Room childrens_bedroom "Childrens Bedroom" with description "You are in the childrens bedroom. Exits lead east and west.", e_to toy_cupboard, w_to upstairs_hallway; Prop -> bunk_bed "bunk bed" with description "bunk bed", name 'bunk' 'bed', has static; !============================================================================= Room toy_cupboard "Toy Cupboard" with description "You are in a toy cupboard. An exit leads west.", w_to childrens_bedroom; Treasure -> teddy_bear "teddy bear" with description "teddy bear", name 'teddy' 'bear', treasurepoints 5; !============================================================================= Room walk_in_wardrobe "Walk-In Wardrobe" with description "You are in a large walk-in wardrobe. An exit leads north.", n_to master_bedroom; Prop -> dress "dress" with description "dress", name 'dress'; Prop -> mirror "mirror" with description "mirror", name 'mirror'; !============================================================================= Room top_of_stairs "Top of Stairs" with description "You are on the landing. There are exits north, east and down.", n_to upstairs_hallway, e_to tiny_closet, d_to entrance_hall; !============================================================================= Room tiny_closet "Tiny Closet" with description "You are in a tiny closet. Exits lead east (through a door) and west.", e_to door_1, w_to top_of_stairs; Prop -> coat "coat" with description "coat", name 'coat'; Connector door_1 "door" with name 'door', door_to [; if (location == tiny_closet) return dusty_passage; return tiny_closet;], door_dir [; if (location == dusty_passage) return w_to; return e_to;], found_in tiny_closet dusty_passage, with_key key; !============================================================================= Room dusty_passage "Dusty Passage" with description "You are in a dusty passage. Exits lead east and west (through a door).", e_to treasure_room, w_to door_1; !============================================================================= Room treasure_room "Treasure Room" with description "You are in the secret treasure room. An exit leads west.", w_to dusty_passage; Treasure -> treasure_01 "treasure" with description "treasure", name 'treasure', treasurepoints 50; !============================================================================= Room small_cupboard "Small Cupboard" with description "You are in a small cupboard. An exit leads south.", s_to large_hallway; !============================================================================= Room dining_room "Dining Room" with description "You are in a large dining room. An exit leads east.", e_to large_hallway; Treasure -> food "food" with description "food", name 'food', treasurepoints 5; !============================================================================= Room large_hallway "Large Hallway" with description "You are in a large hallway. There are exits north, south, east and west.", n_to small_cupboard, s_to entrance_hall, e_to kitchen, w_to dining_room; !============================================================================= Room kitchen "Kitchen" with description "You are in the kitchen. There are exits south, east and west.", s_to larder, e_to back_garden, w_to large_hallway; Hazard -> knife "knife" with description "knife", name 'knife', hazardpoints 30; !============================================================================= Room back_garden "Back Garden" with description "You are in a small tidy garden. An exit leads west.", w_to kitchen; !============================================================================= Room lounge "Lounge" with description "You are in the lounge. An exit leads east.", e_to entrance_hall; Prop -> sofa "sofa" with description "sofa", name 'sofa', has static; Treasure -> cushion "cushion" with description "cushion", name 'cushion', treasurepoints 5; !============================================================================= Room entrance_hall "Entrance Hall" with description "You are in the main hall by the front door. There are exits north, south, east, west and up.", n_to large_hallway, s_to front_porch, e_to downstairs_toilet, w_to lounge, u_to top_of_stairs; !============================================================================= Room larder "Larder" with description "You are in the larder. An exit leads north.", n_to kitchen; Treasure -> key "key" with description "key", name 'key', treasurepoints 5; !============================================================================= Room downstairs_toilet "Downstairs Toilet" with description "You are in a small toilet. An exit leads west.", w_to entrance_hall; Prop -> toilet_02 "toilet" with description "toilet", name 'toilet', has static; !============================================================================= Room front_porch "Front Porch" with description "You are on a porch. An exit leads north.", n_to entrance_hall; !============================================================================= Room bathroom "Bathroom" with description "You are in a large bathroom. An exit leads south.", s_to upstairs_hallway; Prop -> toilet_01 "toilet" with description "toilet", name 'toilet', has static; !============================================================================= ! Setup Daemons Object strength_drain with daemon [; Strength=Strength-1; if (Strength > 0 ) return; StopDaemon(self); GameOver(4); ]; Object endgame_test with daemon [; if (score < MAX_SCORE) return; if (real_location ~= treasure_room) return; StopDaemon(self); GameOver(2); ]; !============================================================================= ! Display end-game messages [ DeathMessage; switch(deadflag) { 3: print "You killed yourself"; 4: print "You ran out of time"; } ]; [ GameOver x; deadflag=x; switch(deadflag) { 2 : print "^Well done, you did it! Just sit on your cushion and enjoy the treasure!"; 3,4: print "^Oh dear! Better luck next time!"; } ]; !============================================================================= ! Initialisation routine [ Initialise; location=front_porch; lookmode=2; #Ifndef NO_HEALTH; StartDaemon(strength_drain); #Endif; ! NO_HEALTH StartDaemon(endgame_test); ]; !============================================================================= ! Include grammar here Include "Grammar"; !============================================================================= ! Custom Verbs [ HealthSub; #Ifdef NO_HEALTH; if (deadflag == 0) "As strong and healthy as usual."; #Ifnot; "You have ",Strength," health points remaining."; #Endif; ! NO_HEALTH ]; Verb meta 'health' 'strength' * -> Health; !=============================================================================