!---------------------------------------------------------------------------- ! ROOM DEFINITIONS - PROLOGUE !---------------------------------------------------------------------------- !------------------------------------------------------------------------ ! Important status indicators for this chapter. ! ! GRASSLAND ! MISC #1 = DIR_OBJ indicating where "forward" will be from now on. !------------------------------------------------------------------------ !---------------------------------------------------------------------------- room grassland "In a Vast Grassland" { inherits game_room !provides initial_desc and long_desc handling. !MISC #1 = which direction we went when we left the grassland. !MISC #2 = set to true if the player didn't go in a specific dir. misc 0,false n_to at_grassy_patch s_to at_grassy_patch e_to at_grassy_patch w_to at_grassy_patch ne_to at_grassy_patch se_to at_grassy_patch sw_to at_grassy_patch nw_to at_grassy_patch before { location DoGo { !Remember which way is back from here. Basically, any direction !the player decides to go is considered "forward" from then on. if (object ~= d_obj, u_obj, in_obj, out_obj) { self.misc #1 = object !Which way we went } return false } location DoGoForward { self.misc #2 = true !Flag that user went forward. perform(&DoGo, random_dir(4)) !Send the player } location DoGoBackward { PrintMessage(9,at_grassy_patch,2) !Can't go back to Homesdale. } } } !---------------------------------------------------------------------------- room at_grassy_patch "At a Grassy Patch" { inherits game_room !provides initial_desc and long_desc handling. before { location DoGo { if (object = game_fore_dir) { PrintMessage(9,self,1) !Can't continue yet. return true } elseif (object = game_back_dir) { PrintMessage(9,self,2) !Can't go back yet return true } elseif (object = u_obj, d_obj, in_obj, out_obj) { return false !Default message for up/down. } else { PrintMessage(9,self,3) !Can't stray from path. return true } } } } !---------------------------------------------------------------------------- ! DAEMON/FUSE DEFINITIONS !---------------------------------------------------------------------------- !---------------------------------------------------------------------------- ! SCENERY OBJECT CLASSES !---------------------------------------------------------------------------- class hidden_glinting_thing { !Gets applied to the hidden glinting thing scenery object(s). nouns "thing", "something", "whatever", "glint", "glimmer", \ "glints", "object" adjectives "glinting", "shiny", "shiney", "small", "concealed", "hidden" article "the" is concealed, unholdable } !---------------------------------------------------------------------------- class grassy_patch { !Gets applied to the grassy patch scenery object(s). nouns "patch", "grass", "blades" adjectives "grassy", "tall", "taller", "thicker" article "the" is container !so "look in" will work - we'll trap for it. capacity 0 !even though we have nothing we're allowed to drop. !Because we really don't have a reason to be ambiguous with the meadow. parse_rank 2 before { !Interpret an attempt to "look in" as a "search" instead. object DoLookIn { Perform(&DoSearch, self) } xobject DoPutIn, DoDrop { if (object = parchment) { return false !let the parchment.before handle it instead. } else { PrintMessage(4,2) !Anything dropped here would be hard to find. } } } } !---------------------------------------------------------------------------- ! ROOM OBJECTS, GROUND OBJECTS !---------------------------------------------------------------------------- !---------------------------------------------------------------------------- ! SCENERY DEFINITIONS !---------------------------------------------------------------------------- scenery distant_glinting_thing "glinting thing" { inherits game_scenery !Provides the long_desc handling. inherits hidden_glinting_thing !Provides nouns and adjectives. found_in grassland is distant parse_rank { if (location = at_grassy_patch) return -2 !Lower the value else return 0 !Default value } before { object DoEnter { !Only if the user said "go" or "walk" -- not "enter". if ((VerbWord = "go","walk") and (word[2] = "to")) { grassland.misc #2 = true !Flag that we went "forward" perform(&DoGo, random_dir(4)) !Send the player } else { return false } } object DoGo,DoApproach { !Because "Go Glint" isn't trapped by DoEnter. grassland.misc #2 = true !Flag that we went "forward" perform(&DoGo, random_dir(4)) !Send the player } xobject DoSearch { if (object = nothing,grassy_meadow) { PrintMessage(3,4,self) !You have to go there to search it. } else { return false !Print default message - that's too far away. } } } } !---------------------------------------------------------------------------- scenery near_glinting_thing "glinting thing" { inherits game_scenery !Provides the long_desc handling. inherits hidden_glinting_thing !Provides nouns and adjectives. !MISC #1 = How many times player has seen the "search fail" message. ! This way, if the player doesn't catch on, we can start ! giving prompts/clues about what to do, transparently. misc 0 found_in at_grassy_patch parse_rank { if (location = grassland) return -2 !Lower the value else return 0 !Default value } before { object DoGet { !User must be searching for it. perform(&DoSearch,near_grassy_patch) } xobject DoSearch { if (object = nothing,near_grassy_patch) { PrintMessage(3,4,self) !Grass is too tall to search. } else { return false !Print default message - don't find, looking for } } } } !---------------------------------------------------------------------------- scenery distant_grassy_patch "taller grassy patch" { inherits game_scenery !Provides the long_desc handling. inherits grassy_patch !Provides nouns and adjectives and defaults. !Why not have a static found_in instead? Well, I need the grassy patch !to be a part of the grassy_meadow (which is in turn a part of both !prologue "rooms") - but since there are two versions (distant and near) !there would be unresolvable disambiguation problems (which do you mean, !the taller grass or the taller grass) otherwise. This way found_in will !only return grassy_meadow for *one* of the "patch" objs... never both. is distant found_in { if (location = grassland) { return grassy_meadow !object is within scenery object, not room. } else { return false } } before { xobject DoSearch { if (object = nothing) { !So that "search for grassy patch" will respond "you see it" DoSearch : return true } else { !But searching for something *in* it says it's too far away. return false } } object DoSearch { PrintMessage(3,4,self) !You have to go there to search it. } object DoEnter { !Only if the user said to "go" or "walk" or "enter" there. !For this one, "into" and "through" and the like will work. if (word[1] = "go","walk","enter") { grassland.misc #2 = true !Flag that we went "forward" perform(&DoGo, random_dir(4)) !Send the player } else { return false } } object DoGo,DoApproach { !Because "Go Grass" isn't trapped by DoEnter. grassland.misc #2 = true !Flag that we went "forward" perform(&DoGo, random_dir(4)) !Send the player } } } !---------------------------------------------------------------------------- scenery near_grassy_patch "taller grassy patch" { inherits grassy_patch !Provides nouns and adjectives and defaults. !Why not have a static found_in instead? Well, I need the grassy patch !to be a part of the grassy_meadow (which is in turn a part of both !prologue "rooms") - but since there are two versions (distant and near) !there would be unresolvable disambiguation problems (which do you mean, !the taller grass or the taller gras) otherwise. This way, found_in will !only return grassy_meadow for *one* of the "patch" objs... never both. found_in { if (location = at_grassy_patch) and (pendant is not moved) { return grassy_meadow !object is within scenery object, not room. } else { return nothing } } long_desc { PrintMessage(3,4,near_glinting_thing) } before { object DoSearch { if (xobject = nothing, near_glinting_thing) { PrintMessage(3,4,near_glinting_thing) return true } elseif (xobject = player) { Perform(&DoSearch, nothing, player) !You're right here. } else { return false !Default message for a search failure. } } object DoEnter, DoGo, DoApproach { PrintMessage(3,5,self) !You're already there } object DoMove,DoPush { PrintMessage(3,7) !You move the grass, but it doesn't help. } object DoPull,DoGet { PrintMessage(3,8) !Say "there must be a better way." } object DoHit { !Only if they specified "with sword" -- otherwise DoHit might !refer to punching, or hitting with hands, etc. So be sure. if (xobject = sword) { perform(&DoCut,object,xobject) } else { return false } } object DoCut, DoAttack, DoBreak { if (xobject = nothing,sword) { if (xobject = nothing) and (verbroutine ~= &DoCut) { !If not cutting, then tell player we implied sword. xobject = sword PrintMessage(6,12,xobject) !"(With your sword)" } if (MakeReadySword) { PrintMessage(5,5) !You chop down the grass move pendant to location : pendant is moved set_pronoun_to = pendant !So player can say "get it" near_glinting_thing.found_in = nothing !It's gone. AddScore(2) !For chopping down the grass. } } else { return false !default handling. } } } } !---------------------------------------------------------------------------- scenery grassy_meadow "grassy meadow" { inherits game_scenery !Provides the long_desc handling. nouns "grass", "meadow", "blades", "field", \ "grassland", "fleece", "ocean", "pasture" adjectives "grassy", "thick", "hip-high", "short", "shorter", \ "green", "smaller", "vast" article "the" found_in grassland, at_grassy_patch is container !so "look in" will work - we'll trap for it. capacity 0 !even though we have nothing we're allowed to drop. before { object DoEnter, DoGo, DoApproach { PrintMessage(3,5,self) !You're already there } object DoSearch { !We can check for pendant not in location, because we can't !move from the location where it's found, after it's found. if (location = at_grassy_patch) and (pendant is not moved) { !Assume the player intended to search the tall grass. PrintMessage(6,1,near_grassy_patch) !Let player know. perform(&DoSearch,near_grassy_patch,xobject) } else { PrintMessage(3,4,self) } } object DoCut { if (location = at_grassy_patch) and (pendant is not moved) { !Assume the player intends to cut down the tall grass PrintMessage(6,1,near_grassy_patch) !Let player know. perform(&DoCut,near_grassy_patch,xobject) } else { return false !Default messages. } } } } !---------------------------------------------------------------------------- ! ROUTINES SPECIFIC TO PROLOGUE !---------------------------------------------------------------------------- routine Chapter_End_Prologue { AddScore(3) !For picking up the pendant. PrintStatusLine !So the score gets updated. PrintMessage(7,1,1) !Cutscene part 1 new_pause PrintMessage(7,1,2) !Cutscene part 2 new_pause StartChapter(1) !Move us to Chapter 1 }