!============================================================================= ! A conversion from the original MiniAdventure source. Constant Story "Shack by Jon Ripley (C) 1995"; Constant Headline "^^It is a beautiful sunny day. However there is a fierce storm approaching and you must get into your shack before it begins...^^A conversion from the original MiniAdventure source.^^"; Serial "050130"; Release 1; ! Constant NO_HEALTH; Constant MAX_SCORE = 5; Include "Parser"; Include "VerbLib"; Global Strength = 30; !============================================================================= ! 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 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 shack "Shack" with description "You are in your shack. An exit leads east (through a door).", e_to door_1; Prop -> broom "broom" with description "broom", name 'broom'; Prop -> bed "bed" with description "bed", name 'bed'; Prop -> chair "chair" with description "chair", name 'chair'; Prop -> table "table" with description "table", name 'table'; !============================================================================= Room small_path_01 "Small Path" with description "You are on a small path. There are exits north, south, east and west.", n_to small_path_01, s_to small_path_02, e_to wooded_area, w_to small_path_01; Prop -> gravel_01 "gravel" with description "gravel", name 'gravel', has static; !============================================================================= Room small_path_02 "Small Path" with description "You are on a small path. There are exits north, south, east and west (through a door).", n_to small_path_02, s_to small_path_01, e_to small_path_02, w_to door_1; Prop -> gravel_02 "gravel" with description "gravel", name 'gravel', has static; Connector door_1 "door" with name 'door', door_to [; if (location == small_path_02) return shack; return small_path_02;], door_dir [; if (location == shack) return e_to; return w_to;], found_in small_path_02 shack, with_key iron_key; !============================================================================= Room wooded_area "Wooded Area" with description "You are in a small wood. There are exits north, south, east and west.", n_to wooded_area, s_to clearing, e_to wooded_area, w_to small_path_01; !============================================================================= Room clearing "Clearing" with description "You are in a clearing. There are exits north, south, east and west.", n_to wooded_area, s_to wooded_area, e_to wooded_area, w_to wooded_area; Treasure -> iron_key "iron key" with description "iron key", name 'iron' 'key', treasurepoints 5; Prop -> grass "grass" with description "grass", name 'grass', has static; Prop -> trees "trees" with description "trees", name 'trees', 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 ~= shack) 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 "^You have made it into your shack in time. Well Done!"; 3,4: print "^Sadly, when the storm arrived you were out in the open. The game ends here..."; } ]; !============================================================================= ! Initialisation routine [ Initialise; location=small_path_02; 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; !=============================================================================