!---------------------------------------------------------------------------- ! ROOM DEFINITIONS - PART 1 !---------------------------------------------------------------------------- !------------------------------------------------------------------------ ! Important status indicators for this chapter. ! ! LOFT_LADDER ! MISC #1 = The ladder to the loft has been lowered (true or false). ! ! GATE_KEY ! MISC #1 = The location where we found the gate key. ! ! DISTANT_WAGON ! MISC #1 = The player has climbed up to loft via wagon (true or false). ! ! BEES ! MISC #1 = Bees have flow to the girl now (true or false) ! ! GIRL ! MISC #1 = The girl has noticed the player (true or false) !------------------------------------------------------------------------ !---------------------------------------------------------------------------- room farm_path "On a Worn Path" { inherits game_room !provides initial_desc and long_desc handling. e_to house before { location DoGoForward { !This overrides the "real" forward/backward set in prologue. perform(&DoGo, e_obj) !Send the player to the east from here. } location DoGoBackward { !This overrides the "real" forward/backward set in prologue. perform(&DoGo, w_obj) !Send the player to the west from here. } Location DoLook { if (object = d_obj) Perform(&DoLook, dusty_path) else return false } } } !---------------------------------------------------------------------------- room house "At a Two-Story Farm House" { inherits game_room !provides initial_desc and long_desc handling. n_to { return north_gate.door_to } s_to { return south_gate.door_to } e_to { return barn_doors.door_to } in_to { return barn_doors.door_to } w_to { !I can fix the loophole by letting the player go back *if* anything !is dropped -- not just the pendant. !if Contains(farm_path, pendant) { if child(farm_path) { !If the player dropped the pendant, at least let him go back. return farm_path } else { PrintMessage(9,self,w_obj) return true !So we don't get "you can't go that way" mesasge. } } each_turn { ! The northern gate is distant and "northern" when here. if (north_gate.name = "gate") { north_gate.name = "northern gate" north_gate is distant north_gate.adjectives #1 = "n" north_gate.adjectives #2 = "north" north_gate.adjectives #3 = "northern" } ! The southern gate is "southern" (but not distant) when here. if (south_gate.name = "gate") { south_gate.name = "southern gate" south_gate.adjectives #1 = "s" south_gate.adjectives #2 = "south" south_gate.adjectives #3 = "southern" } ! The northern fence is "northern" when here. if (north_fence.name = "fence") { north_fence.name = "northern fence" north_fence.adjectives #1 = "n" north_fence.adjectives #2 = "north" north_fence.adjectives #3 = "northern" } ! The southern fence is "southern" when here. if (south_fence.name = "fence") { south_fence.name = "southern fence" south_fence.adjectives #1 = "s" south_fence.adjectives #2 = "south" south_fence.adjectives #3 = "southern" } !The "loft" is concealed when we're here. if (distant_loft is not concealed) { distant_loft is concealed } !And, the windows should not be distant. if (barn_windows is distant) { barn_windows is distant } } } !---------------------------------------------------------------------------- room hill "On the Feeding Hill" { inherits game_room !provides initial_desc and long_desc handling. !MISC #1 = false usually, but true whenever rope is tied and we leave. misc false s_to { return north_gate.door_to } se_to { return barn_northexit.door_to } in_to { return barn_northexit.door_to } out_to { return north_gate.door_to } each_turn { ! The northern gate becomes just the "gate" when you're here. ! This is because it's a little odd to refer to it as the ! northern gate, when it's now south of you. So, this fixes. if (north_gate.name = "northern gate") { north_gate.name = "gate" north_gate is not distant north_gate.adjectives #1 = "" !Remove "n" north_gate.adjectives #2 = "" !Remove "north" north_gate.adjectives #3 = "" !Remove "northern" } if (north_fence.name = "northern fence") { north_fence.name = "fence" north_fence.adjectives #1 = "" !Remove "n" north_fence.adjectives #2 = "" !Remove "north" north_fence.adjectives #3 = "" !Remove "northern" } } } !---------------------------------------------------------------------------- room orchard "In an Orchard" { inherits game_room !provides initial_desc and long_desc handling. n_to { return south_gate.door_to } ne_to { return barn_southexit.door_to } in_to { return barn_southexit.door_to } out_to { return south_gate.door_to } each_turn { ! The southern gate becomes just the "gate" when you're here. ! This is because it's a little odd to refer to it as the ! southern gate, when it's now north of you. So, this fixes. if (south_gate.name = "southern gate") { south_gate.name = "gate" south_gate.adjectives #1 = "" !Remove "s" south_gate.adjectives #2 = "" !Remove "south" south_gate.adjectives #3 = "" !Remove "southern" } if (south_fence.name = "southern fence") { south_fence.name = "fence" south_fence.adjectives #1 = "" !Remove "s" south_fence.adjectives #2 = "" !Remove "south" south_fence.adjectives #3 = "" !Remove "southern" } ! The entrance into the barn becomes northeast. if (barn_southexit.name = "southwest exit") { barn_southexit.name = "entrance panel" barn_southexit.nouns #1 = "entrance" barn_southexit.nouns #2 = "door" barn_southexit.nouns #3 = "" barn_southexit.adjectives #1 = "northeastern" barn_southexit.adjectives #2 = "northeast" barn_southexit.adjectives #3 = "ne" barn_southexit.adjectives #4 = "entrance" barn_southexit.adjectives #5 = "barn's" barn_southexit.adjectives #6 = "bulky" } } before { object DoSniff { PrintMessage(13,self,1) !The air smells like apple blossoms. } } } !---------------------------------------------------------------------------- room barn "In the Barn" { inherits game_room !provides initial_desc and long_desc handling. w_to { return barn_doors.door_to } d_to { return hatch.door_to } u_to { return loft_ladder.door_to } nw_to { return barn_northexit.door_to } sw_to { return barn_southexit.door_to } in_to { return hatch.door_to } each_turn { ! The exit from the barn becomes southwest. if (barn_southexit.name = "entrance panel") { barn_southexit.name = "southwest exit" barn_southexit.nouns #1 = "exit" barn_southexit.nouns #2 = "outline" barn_southexit.nouns #3 = "rectangle" barn_southexit.adjectives #1 = "southwestern" barn_southexit.adjectives #2 = "southwest" barn_southexit.adjectives #3 = "sw" barn_southexit.adjectives #4 = "exit" barn_southexit.adjectives #5 = "thin" barn_southexit.adjectives #6 = "rectangular" } ! The hatch and its handle become distant if (hatch is distant) { hatch is not distant hatch_handle is not distant } ! The "loft" is not concealed when we're here. if (distant_loft is concealed) { distant_loft is not concealed } ! The "flat_lever" is distant when we're here. if (flat_lever is not distant) { flat_lever is distant } !Ladder is distant only if it's not lowered. if (loft_ladder.misc #1) { !Ladder should not be distant if (loft_ladder is distant) { loft_ladder is not distant } } else { !Ladder should be distant if (loft_ladder is not distant) { loft_ladder is distant } } } before { object DoSniff { PrintMessage(13,self,1) !The odor of livestock is strong. } } } !---------------------------------------------------------------------------- room loft "In the Loft" { inherits game_room !provides initial_desc and long_desc handling. d_to { return loft_ladder.door_to } in_to { return loft_ladder.door_to } out_to { return loft_ladder.door_to } w_to { word[1] = "go out the windows" PrintMessage(6,1) !"(assuming you mean to go out the windows)" Perform(&DoGo,barn_windows) !We can't, but trap and message it. } ground_name "floor" each_turn { !The "flat_lever" is not distant when we're here. if (flat_lever is distant) { flat_lever is not distant } !The ladder is not distant when we're here. if (loft_ladder is distant) { loft_ladder is not distant } !The windows should not be distant. if (barn_windows is distant) { barn_windows is not distant } } } !---------------------------------------------------------------------------- room cellar "In the Cellar" { inherits game_room !provides initial_desc and long_desc handling. u_to { return hatch.door_to } out_to { return hatch.door_to } ground_name "floor" each_turn { ! The hatch and its handle become distant if (hatch is not distant) { hatch is distant hatch_handle is distant } } } !---------------------------------------------------------------------------- ! DAEMON/FUSE DEFINITIONS !---------------------------------------------------------------------------- daemon girl_moving { !MISC #1 = how many turns have lapses since the girl moved. !MISC #2 = how many turns must pass before auto-moving. !MISC #3 = a flag that something happened to prevent leaving (one turn). !MISC #4 = total number of times the girl has ran away automaticaly. !MISC #5 = total number of turns the girl has ran when forced to run. misc 0, 4, false, 0, 0 ! We allow 3 turns before auto moving. Just entering the room where she ! is counts as one, so three more means the player can do three things ! before she moves, whenever there is only one open exit. This should ! give the player time to pick up the beam, bar the door with it, and ! even have a turn to spare. I think that's fair enough for the puzzle. } event in girl_moving { local newroom = nothing !Which room will she go? !First, we only need to do this if the girl is actually here. if (girl not in location): return self.misc #1 ++ !Increment number of turns since last move. if (self.misc #3) { self.misc #3 = false !Reset the flag return !We skipped her movement. } newroom = get_girl_movement(location, self.misc #1) if (newroom ~= nothing) { if (self.misc #1 > 1) and (location = prev_location) { ! For some reason "print newline" doesn't. ! At least not in this case. But blank will. !!!! print newline print "" } ! Okay. The text is a little long, and becomes somewhat MadLib like ! after you've seen it a few times. So, we're going to count the ! total number of times the girl has ran. After a little bit, we'll ! start printing a short description sometimes, and after that, we'll ! print it *every* time. Basically, the player doesn't need to keep ! reading long variations of the same text very time. self.misc #4 ++ !Increment number of times she has ran from us. if (self.misc #4 <= 2): rnd = 1 elseif (self.misc #4 < 4): rnd = random(2) elseif (self.misc #4 < 6): rnd = random(3) elseif (self.misc #4 < 8): rnd = random(4) elseif (self.misc #4 < 10): rnd = random(5) else: rnd = 0 !After ten times, never long. if (self.misc #1 = 1) or (location ~= prev_location) { !If she left on the very first turn, indent. indent !Begin with a paragraph indentation. } if (rnd = 1) { !Long Movement Description PrintMessage(16,0,self.misc #1) !Initial Movement Text. PrintMessage(16,location,newroom) !From-To Combination. PrintMessage(16,1) !And, then comes the ending portion. } else { !Short Movement Description PrintMessage(16,2,newroom) } move girl to newroom self.misc #1 = 0 ! Reset turn counter for movement. girl.misc #4 = location !Remember where she last was. } } !---------------------------------------------------------------------------- ! SCENERY OBJECT CLASSES !---------------------------------------------------------------------------- class upturned_wagon { nouns "cart", "wagon" adjectives "upturned" article "an" is platform !so "put wheel on..." will work. is container !Because players might try to put stuff "in" it too. capacity 1 !even though we have nothing we're allowed to drop. } !---------------------------------------------------------------------------- class apple_tree_redirs { before { !These are verbs that are redirected to the tree itself. object DoClimb, DoSearch, DoGet, DoShake, DoHit, DoKick, \ DoMove, DoPush, DoPull, DoTouch { if (self = apple_trees) { print "("; The(apple_tree); ")" !Let the player know it. } Perform(verbroutine, apple_tree, xobject) !Redirect tree itself. } xobject DoGet,DoGetFrom { Perform(verbroutine, object, apple_tree) !Redirect tree itself. } } } !---------------------------------------------------------------------------- ! ROOM OBJECTS, GROUND OBJECTS !---------------------------------------------------------------------------- scenery dusty_path "dusty path" { inherits game_scenery !Provides the long_desc handling. inherits ground_class !Provides "put-in" drop handling. nouns "path", "trail", "ground", "channel" adjectives "dusty", "well", "worn", "well-worn", \ "traveled", "travelled" article "the" found_at farm_path } !---------------------------------------------------------------------------- scenery house_yard "yard" { inherits game_scenery !Provides handling for the description. inherits ground_class !Provides "put-in" drop handling. nouns "yard", "ground", "dirt", "dust" adjectives "dusty", "dirty" article "the" found_at house } !---------------------------------------------------------------------------- scenery in_barn "barn" { !Note that this does not inherit game_scenery. inherits roomobject_class !But it does get this. nouns "barn", "shed", "shack", "stable", "stables" adjectives "large" !Because it's "large inside" article "the" found_in barn } !---------------------------------------------------------------------------- scenery in_orchard "orchard" { !Note that this does not inherit game_scenery. inherits roomobject_class !But it does get this. nouns "orchard" article "the" found_in orchard } !---------------------------------------------------------------------------- scenery orchard_ground "ground" { inherits game_scenery !Provides the long_desc handling. inherits ground_class !Provides "put-in" drop handling. nouns "ground", "grass" article "the" found_in orchard } !---------------------------------------------------------------------------- scenery in_cellar "cellar" { !Note that this does not inherit game_scenery. inherits roomobject_class !But it does get this. nouns "cellar", "cave" adjectives "cave-like" article "the" found_in cellar } !---------------------------------------------------------------------------- scenery cellar_floor "cellar floor" { inherits game_scenery !Provides the long_desc handling. inherits ground_class !Provides "put-in" drop handling. nouns "floor", "ground", "bottom", "dirt" adjective "cellar", "cellars", "cellar's", "dirt" article "the" found_in cellar } !---------------------------------------------------------------------------- ! Thanks to Wikipedia for the "hayloft" and "mow" synonyms. I didn't know! ! scenery in_loft "loft" { !Note that this does not inherit game_scenery. inherits roomobject_class !But it does get this. nouns "loft", "hayloft", "mow" article "the" found_in loft } !---------------------------------------------------------------------------- scenery loft_floor "loft floor" { inherits game_scenery !Provides the long_desc handling. inherits ground_class !Provides "put-in" drop handling. nouns "floor", "ground", "boards", "edge", "ledge", "side" adjective "dusty", "wooden", "floor", "flat", "loft" article "the" found_in loft before { xobject DoDropDown { ! Assume we really mean to drop things into the barn. Perform(&DoDropDown, object, barn_below) !redirect } } } !---------------------------------------------------------------------------- ! SCENERY DEFINITIONS !---------------------------------------------------------------------------- scenery fence_gap "gap in the northern fence" { inherits game_scenery !Provides the long_desc handling. nouns "gap", "opening" article "the" found_at house, hill is unholdable before { object DoEnter, DoGo { perform(&DoEnter, north_gate) !Redirect entry though gate. } } } !---------------------------------------------------------------------------- ! I wasn't originally going to include this, but *if* the player decides to ! refer to them in the plural, it could get a little funny. I *could* go the ! route of adding a plural noun to both fences, but with a little more effort ! I can make things more realistic. This is the first time I've used the ! plural_class in a game. I tried in Trading Punches (for the cups), but it ! didn't really simplify what I was doing there. Here, it'll be perfect. ! plural_class fences "fences" { inherits game_scenery !Provides the long_desc handling. nouns "fences" single_noun "fence" adjectives "decrepit" article "the" plural_of north_fence, south_fence ! Mainly so that "decrepit" used alone doesn't include *this* version ! of the two fences in disambiguation. That'd look really funky. But ! if the player says "decrepit fences" it'll at least be recognized. parse_rank -2 !Put it below the *real* fences (which have default 0). before { object DoGet { VMessage(&DoGet, 7) ! "You can't take those." } } } !---------------------------------------------------------------------------- scenery north_fence "northern fence" { inherits game_scenery !Provides the long_desc handling. nouns "fence", "slats" adjectives "n", "north", "northern", "decrepit" article "the" found_at house, farm_path, hill plural_is fences before { object DoEnter, DoGo, DoApproach { if (location = house, hill) { perform(&DoEnter, north_gate) !Redirection to the gate. } else { return false !Can't enter the fence } } } } !---------------------------------------------------------------------------- scenery south_fence "southern fence" { inherits game_scenery !Provides the long_desc handling. nouns "fence", "slats" adjectives "s", "south", "southern", "decrepit" article "the" found_at house, farm_path, orchard plural_is fences before { object DoEnter, DoGo, DoApproach { if (location = house, orchard) { perform(&DoEnter, south_gate) !Redirection to the gate. } else { return false !Can't enter the fence. } } } } !---------------------------------------------------------------------------- ! And here I'll use the plural class again, since there are two gates. ! plural_class gates "gates" { inherits game_scenery !Provides the long_desc handling. nouns "gates" single_noun "gate" adjectives "wooden" article "the" plural_of north_gate, south_gate ! Mainly so that "wooden" used alone doesn't include *this* version ! of the two gates in disambiguation. That'd look really funky. But ! if the player says "wooden gates" it'll at least be recognized. parse_rank -2 !Put it below the *real* gates (which have default 0). before { object DoGet { VMessage(&DoGet, 7) ! "You can't take those." } } } !---------------------------------------------------------------------------- scenery north_gate "northern gate" { inherits game_scenery !Provides the long_desc handling. nouns "gate", "door" ! Note that the first 3 adjectives specify the direction! adjectives "n", "north", "northern", "wooden", "crushed", \ "decaying", "decayed", "broken" article "the" found_at house, hill is openable, open, lockable, not locked, distant, broken, not fixable plural_is gates !reference back to plural_class parse_rank { ! For certain verbs, it would make more sense to assume that the ! player is talking about the northern gate, not the southern one. ! For those purposes, it is friendlier to not be ambiguous. if (location = house) and (verbroutine = &DoRight) { return 1 !Higher parse rank } else { return 0 !Default parse rank } } door_to { if (location = hill) { !First, check to see if the rope is attached to something. rnd = false !A flag just for this little bit. if IsAttached(rope, wagon_hitch): rnd = true if (harness in bull) and IsAttached(rope, harness): rnd = true if Contains(player,rope) and (rnd) { !Set temporary flag for benefit of PrintMessage(9,hill). hill.misc #1 = true !This is our temporary flag. return nothing } else { return house } } else { return hill } } before { object DoOpen, DoClose, DoLock, DoUnlock { PrintMessage(3,13) !The door is broken. You can't. } object DoSearch { !The key's found just by "looking" at the gate, too. if (gate_key is not known) and \ (gate_key is not moved) and \ (location = hill) { PrintMessage(2,north_gate,2) !Finds the key. gate_key is moved : gate_key is known move gate_key to location gate_key.misc #1 = location KeyIsForGate !Change the key properties AddScore(22) !For discovering the key. } else { return false !Default handling for search. } } } after { object DoLook { if (gate_key is not known) and \ (gate_key is not moved) and \ (location = hill) { ! We must have discovered the key if we looked at the gate, ! so move it to this location (the feeding hill) now. ! Ordinarily, the key can be found in the cabinet behind ! the cask in the barn, but this is another way to find it. gate_key is moved : gate_key is known move gate_key to location gate_key.misc #1 = location KeyIsForGate !Change the key properties } return false !So default handling works. } } } !---------------------------------------------------------------------------- scenery south_gate "southern gate" { inherits game_scenery !Provides the long_desc handling. !MISC #1 = gate has been notched. Just for persistence. misc false nouns "gate", "door" ! Note that the first 3 adjectives specify the direction! adjectives "s", "south", "southern", "wooden", "sturdy" article "the" found_at house, orchard is openable, not open, lockable, locked plural_is gates !reference back to plural_class parse_rank { ! For certain verbs, it would make more sense to assume that the ! player is talking about the southern gate, not the northern one. ! For those purposes, it is friendlier to not be ambiguous. if (location = house) and \ (verbroutine = &DoOpen,&DoLock,&DoClose,&DoUnlock,\ &DoPush,&DoPull,&DoHit,&DoCut,&DoBreak,\ &DoKick,&DoAttack,&DoShake,&DoStab) { return 1 !Higher parse rank } else { return 0 !Default parse rank } } key_object gate_key !I'm going to simplify it by implying that the player wants to !open and/or unlock the gate, whenever trying to pass through it. door_to { if (self is locked) { if Contains(player, self.key_object) { print "(unlocking the gate with "; print The(self.key_object); " first)" self is not locked KeyIsForGate !Change the key properties PrintMessage(6,19,self) !"(and then opening it)" self is open return self.door_to !Return linked room. } else { set_pronoun_to = self !So "it" will work. return false !So that we don't print default. } } else { if (self is not open) { PrintMessage(6,6,self) !Opening the gate first self is open } if (location = orchard) { return house } else { return orchard } } } before { object DoPush, DoPull { if (self is open) { word[1] = "close" PrintMessage(6,2,"it") Perform(&DoClose,self) } else { word[1] = "open" PrintMessage(6,2,"it") Perform(&DoOpen,self) } } object DoOpen { if (self is locked) { if Contains(player, self.key_object) { print "(unlocking it with "; print The(self.key_object); " first)" self is not locked KeyIsForGate !Change the key properties PrintMessage(6,19,self) !"(and then opening it)" } } return false !So default messages work afterwards. } object DoLock { if (self is open) { if Contains(player, self.key_object) { "(closing it first)" self is not open print "(and then "; "locking it with "; print The(self.key_object); ")" perform(&DoLock, self, self.key_object) return true !No need for default message. } } return false ! so default message works afterwards. } object DoKick, DoHit, DoBreak, DoAttack, DoCut, DoStab, DoShake { if (verbroutine = &DoCut, &DoStab) and (xobject = nothing) { !Assumes we want to cut with sword. if (not MakeReadySword) { return true } } if (xobject = sword) { !In case the player needs to draw it. if (MakeReadySword) { PrintMessage(5,9,1) !Attack is allowed, but doesn't work. self.misc #1 = true !Just changes a bit of the descript. } } else { PrintMessage(5,9,2) !Attack without sword. Still won't work. } } } } !---------------------------------------------------------------------------- scenery livestock "farm animals" { inherits game_scenery !Provides handling for the description. !Adjective "farm" is so we can say "farm animals" for instance. nouns "livestock", "cattle", "sheep", "chicken", "chickens", \ "goat", "goats", "pig", "pigs", "animals", "lifestock", "cows" adjectives "farm" article "the" found_in barn, hill is plural, concealed, distant before { object DoChase { if (location = barn) { !Attempt to "follow" or "chase" animals = Go Outside. perform(&DoGo, nw_obj) } else { PrintMessage(3,1,self) !They're too far away. } } } } !---------------------------------------------------------------------------- scenery wagon "upturned wagon" { inherits game_scenery !Provides handling for the description. inherits upturned_wagon !Provides noun, article, adjective. found_on hill is broken, fixable before { object DoRepair { if Contains(player,wheel) and (xobject = nothing) { xobject = wheel PrintMessage(6,12,wheel) !"(With the wheel)" } if (wagon is broken) and (xobject = wheel) { Perform(&DoPutIn,wheel,self) !Redirect } else { return false !Default messages handle it. } } object DoPush, DoPull, DoMove, DoRight, DoLift { PrintMessage(3,18,1) !No way will that work. Too heavy. } Object DoGet { PrintMessage(10,self,1) !No way. It's too big. } object DoClimb, DoEnter { !The sole purpose in allowing this is to make it more obvious, !should the player attempt it, that you can climb up the wagon !to get into the loft (later, after it crashs). It doesn't !really matter if the player tries or not, since there is one !more way (involving the apple) to get into the loft. SheatheSword !We have to put the sword away first. PrintMessage(9,self,1) !No reason to climb up it, but can. } xobject DoPutIn { if (object = wheel) { SheatheSword !Make sure we put the sword away. if IsAttached(rope,wheel) { print "(untying "; The(rope); " "; print rope.detach_prep; " "; The(wheel); " first)" ObjectDetach(rope,wheel) } PrintMessage(6,5) !Put the wheel on the wagon. move wheel to wagon !And now it's on the wagon. wheel is not mobile !We can't leave if rope is tied. wheel is hidden !So that it's not auto-listed. wheel is static !It's no longer a regular object. wagon is not broken !It's repaired. wagon_axles is not broken !That too AddScore(16) !For fixing the wagon. } else { PrintMessage(4,10,object) !Can't put anything in it. } } xobject DoGetFrom { ! The "wagon_wheels" already trap for a "get", but if the player ! says "get wheel from wagon" and the single wheel is not there, ! then we'd otherwise get a misleading message saying not there. if (object = wheel) and (wheel not in wagon) { PrintMessage(10,wagon_wheels) !Wagon's better off keeping it. } else { return false !Everything else is covered by defaults. } } xobject DoStrap { ! Here, we can actually handle the "attach" verb for things ! that aren't actually attachable -- namely, the wheel. So, ! check all the conditions, otherwise fall through to default. ! We also check certain verb words (i.e. "strap" won't work). if (object = wheel) and \ (VerbWord = "attach", "fasten", "connect", "link") { if Contains(player,object) { Perform(&DoPutIn, object, self) !Redirect to DoPutIn } else { if (wheel in self) { PrintMessage(2,self,2) !It's already fixed. } else { ParseError(15,wheel) !You're not holding the wheel. } } } else { return false !Default handling - will probably re-route. } } object DoUntie, DoUnstrap { ! If we try to "untie wagon" (instead of "untie rope from...) ! then we'll just redirect to the hitch instead. Perform(verbroutine,wagon_hitch,xobject) !Redirect to the hitch. } xobject DoAttachObject, DoDetachObject { !Redirect attempts to tie/untie anything to wagon, to the hitch. Perform(verbroutine,object,wagon_hitch) } } } !---------------------------------------------------------------------------- component wagon_wheels "wagon wheels" { inherits game_scenery !Provides handling for the description. nouns "wheels" adjectives "wagon" article "the" is plural part_of wagon before { object DoGet { PrintMessage(10,self,1) } xobject DoAttachObject { if (wheel in wagon) { !We can attach to the lone wheel instead. Perform(&DoAttachObject,object,wheel) !Although now that it's on, that's pointless. } else { !Default handling. } } } } !---------------------------------------------------------------------------- component wagon_hitch "wagon's hitch" { inherits game_scenery !Provides handling for the description. nouns "hitch" adjectives "yoke", "wagon", "wagon's", "wide" article "the" part_of wagon before { object DoUntie, DoUnstrap { if (xobject = nothing) and IsAttached(rope,self) { ! The player probably means to untie the rope. No need to ! print an "implied" message, because it's most likely ! what the player meant. Almost definitely what they meant. Perform(&DoDetachObject, rope, self) !Deatch from it. } else { PrintMessage(4,14,10) !Nothing is attached to this. } } } } !---------------------------------------------------------------------------- component wagon_axles "wagon's axles" { inherits game_scenery !Provides handling for the description. nouns "axle", "axles" adjectives "wagon", "wagon's" article "the" is plural, platform, broken, fixable part_of wagon parse_rank { if IsWord("wheel") return -2 !So it's not ambiguious with real "wheel" object. else return 0 !Default parse rank } before { object DoRepair { !General redirected actions for the axles. perform(verbroutine, wagon, xobject) !axle redirs to wagon. } xobject DoPutIn { if (object = wheel) { perform(&DoPutIn, object, wagon) !Put it on the wagon. } else { PrintMessage(4,11,object) !Can't put anything on axles. } } xobject DoStrap { ! Here, we can actually handle the "attach" verb for things ! that aren't actually attachable -- namely, the wheel. So, ! check all the conditions, otherwise fall through to default. ! We also check certain verb words (i.e. "strap" won't work). if (object = wheel) and \ (VerbWord = "attach", "attatch", "fasten", "connect", "link") { ! Ultimately we want to do a DoPutIn on the wagon, but ! we'll let the xobject.DoStrap of the wagon handle it. Perform(&DoStrap, object, wagon) !Redirect to wagon. } else { return false !Default handling. } } xobject DoAttachObject,DoDetachObject { ! Redirect attempts to tie/untie anything to axle, to the hitch. ! I thought about allowing it, because if the player can really ! visualize this, it'd be easier to pull the wagon over if you ! tie the rope to the axle that's sticking up in the air. But, ! as long as I allow the player to *try* that, I can just do it ! for the wagon_hitch instead, and let it work that way. if (verbroutine = &DoAttachObject) { print "("; object.attach_prep; " "; The(wagon_hitch); ")" } else { print "("; object.detach_prep; " "; The(wagon_hitch); ")" } Perform(verbroutine,object,wagon_hitch) } } } !---------------------------------------------------------------------------- scenery distant_wagon "upturned wagon" { inherits game_scenery !Provides handling for the description. inherits upturned_wagon !Provides noun, article, adjective. !MISC #1 = climbed up onto the roof once. Can't do it again. misc false is distant, broken, not fixable found_on { !When the normal wagon is gone, this one is here. if (wagon.found_on = hill) { return nothing } else { return hill } } before { object DoClimb { if (self.misc #1) { if (girl in barn) and \ not get_girl_movement(barn,girl_moving.misc #2) { !The girl is trapped in there. That's a good reason. ! Here, we don't have to sheathe the sword until ! after printing the intro, because it doesn't say ! that the player climbs up. That comes in the room. ! There is no need to test dropping the wheel, either. ! If all barn exits are blocked, we can't still have it. ! And lastly, we don't need to set self.misc #1, because ! we're in a block of code that already required it on. PrintMessage(9,self,3) !It's worth risking it now. SheatheSword !We have to put the sword away first. MovePlayer(loft) !And then move the player to the loft. barn_windows is open !Because we opened to get inside. } else { PrintMessage(9,self,1) !Can't climb up there again. } } else { !Sheathe sword first, because intro part includes climb. SheatheSword !We have to put the sword away first. DropTheObject(wheel) !It's too big to carry up with us. PrintMessage(9,self,2) !Initial text for the climbing. MovePlayer(loft) !And then move the player to the loft. barn_windows is open !Because we opened to get inside. self.misc #1 = true !We've climbed up this way once. } } object DoRepair { PrintMessage(3,23,self) !It's not possible to fix it. } object DoPush, DoPull, DoMove, DoRight { ! In case the player tries to push it over now, we shouldn't ! say "it's too far away" (which is the default for distant ! objects, on these verbs. That might just confuse and then ! frustrate them, because they'd try to "go there" and that ! can't really be done. So, print a message: there's no point. rnd = random(2) select rnd case 1: PrintMessage(3,2,5) !You see no good way to do that. case 2: PrintMessage(3,2,13) !Nothing is to be gained by that. } } } !---------------------------------------------------------------------------- scenery bull "bull" { inherits game_scenery !Provides handling for the description. inherits animal !To trap for attempts to talk, ask, show, give, etc. nouns "cow", "bull", "toro", "beast", "animal" article "a" found_on hill is living, platform !platform basicaly so "put harness on bull" works. capacity 1 !Even though we're not going to put anything else on it. !Okay, bull isn't "attachable" but we fake it out at one point. And !Omessage(attachable, 8) gets called at least once, telling the player !to be more specific about what they want to "attach" the bull to. So, !let's fill in these properties, so the OMessage can work correctly. attach_prep "to" attach_verb { if (verbroutine = &DoTie, &DoStrap) and \ (VerbWord ~= "wind", "wrap", "loop") { return VerbWord } else { return "harness" !just in case. } } before { object DoProvoke { ! Because the bull's description mentions "exciting" it. ! Man, it's hard to tell the player *anything* without being ! obligated to handle their attempt to try exactly that. if (harness in bull) and \ IsAttached(rope,wagon_hitch) and \ IsAttached(rope,harness) { PrintMessage(3,2,11) !"How, though?" } else { !Randomized messages. rnd = random(2) if (rnd = 1) { PrintMessage(3,2,6) !Better not. PrintMessage(3,2,12) !At least, not yet. } else { PrintMessage(3,2,10) !If your own saftey was less import. } } } object DoClimb, DoRide, DoEnter { !Player is attempting to ride the bull somehow. PrintMessage(9,self) !Yeah, not a good idea. } xobject DoPutIn { if (object = harness) { if Contains(player,harness) { if (grain in trough) { PrintMessage(6,8,1) !Strap the bull into the harness. harness is not mobile !We can't leave if rope is tied. harness is hidden !So that it's not auto-listed. harness is static !It's no longer a regular object. move harness to bull !Now, it's on the bull. AddScore(26) !For harnessing the bull. } else { PrintMessage(4,14,1) !Can't. The bull won't let you. } } else { ParseError(15,harness) !You're not holding the harness. } } else { PrintMessage(3,2,6) !"Better not." -- player can't do this. } } object DoTie, DoStrap { ! This has been added after the first beta, due to some big ! frustrations the testers had. Currently, you have to take ! each thing one step at a time - put the harness on the bull, ! tie the rope to the harness, tie the rope to the wagon hitch. ! But, several testers tried "strap bull to wagon" and "tie ! bull to wagon" (as well as the inverse, possibly). So, I ! need to trap for this, and give players useful feedback. If ! everything is good (rope not already tied, harness on bull) ! then we should be able to do each thing implicitly. This is ! going to be a pretty big logic tree, but I think it'll work. if (xobject = nothing) and \ (VerbWord ~= "wind", "wrap", "loop") { ! First, trap for attempts to "harness bull" without player ! specifying *what* to harness it to. Also, verify that the ! verbwords are not in an invalid list of words. Then, we ! trap for a special condition where player is trying to ! "strap bull" or "harness bull" and they have the harness ! but not the rope. This probably means putting the harness ! onto the bull, and that's how we'll handle it. if not Contains(location,rope) and \ Contains(player,harness) and \ (VerbWord = "harness", "strap") { ! Put the harness on the bull. Perform(&DoPutIn,harness,self) !Redirect the action. } else { ! Tell the player to be more specific about it. OMessage(attachable,8) !Be more specific about what. } } elseif (xobject = wagon, wagon_hitch, wagon_axles) and \ (VerbWord ~= "wind", "wrap", "loop") { if IsAttached(rope, harness) and \ IsAttached(rope, wagon_hitch) { if (harness in bull) { ! Let the player know that the bull is already tied ! to the wagon. Just in case of trying it again. PrintMessage(4,14,4) !Bull already tied to wagon. } else { ! The player tied the harness to the wagon, so let's ! try to put the harness on the bull implicitly. ! Ordinarily, we wouldn't. After all, players must ! make *some* sort of effort. word[1] = "put" !Keep it simple. PrintMessage(6,2,"the harness on the bull") !Messg. Perform(&DoPutIn,harness,self) !Redirect the action. } } elseif not Contains(location,rope) { PrintMessage(4,14,5) !Don't have the rope, basically. } elseif (AttachedCount(rope) >= 2) { ! If the rope is attached to two things and we get ! to this point, then it can't be attached to the two ! *correct* things (the harness and the hitch). If it ! was, then it would have been caught and handled a ! little earlier in this logic block. So, we can assume ! that it's tied to something else (probably the wheel), ! and we should tell the player that we can't take this ! action while it's attached to that. PrintMessage(4,14,6) !You would have to untie from... } elseif (AttachedCount(rope) >= 1) and \ IsAttached(rope) ~= harness, wagon_hitch { ! It's only attached to one thing, but the thing it's ! attached to isn't either of the things it should be. PrintMessage(4,14,6) !You would have to untie from... } elseif not Contains(location, harness) { PrintMessage(4,14,2) !Swordsman considers the options. } else { ! Otherwise, everything has been checked out. There is ! nothing stopping us from handling all the necessary ! actions on the player's behalf. We'll start with the ! harness. If it's not on the bull, we'll imply putting ! it on. If that fails (no grain in trough or something) ! then we won't continue on with tying the rope). rnd = false !We'll let this be a flag. word[1] = "tie" !Because these verbroutines will care. if (harness not in bull) { PrintMessage(4,14,7) !First putting the harness on. Perform(&DoPutIn,harness,self) !Redirect the action. if (harness in bull) { rnd = true !Flag that we took an action. } else { return true !There was a failure doing that. } } if not IsAttached(rope, harness) { PrintMessage(4,14,8) !Then tying rope to harness. Perform(&DoAttachObject,rope,harness) !Perform it. PrintMessage(1,self,2) !Describe rope being tied. rnd = true !Flag that we took an actions. } if not IsAttached(rope, wagon_hitch) { PrintMessage(4,14,9) !Then tying rope to the hitch. Perform(&DoAttachObject,rope,wagon_hitch) !Perform PrintMessage(1,self,2) !Describe rope being tied. rnd = true !Flag that we took an actions. } } } else { return false ! Default "Can't tie/attach the bull" } } object DoUntie, DoUnstrap { if (xobject = nothing) { if (harness in bull) { if IsAttached(rope,harness) { ! The player probably means to untie the rope from ! the harness. Thing is, they *might* mean to ! unstrap the harness from the bull, so in this ! event, we probably do want to give an "implied" ! message, so they know. PrintMessage(6,2,"the rope from the harness") Perform(&DoDetachObject, rope, self) !Deatch from. } else { ! Okay, no rope, so assume player is trying to ! take back the harness, instead. We have to do ! an implied message here, because the resulting ! denial action refers to "it" (players must know). PrintMessage(6,2,"the harness from the bull") Perform (&DoGetFrom, harness, self) !Redirection. } } else { ! The bull isn't harnessed to anything. PrintMessage(4,14,10) !Let the player know. } } else { return false !Whatever the default message is. } } xobject DoTie, DoStrap { ! This'll get trapped before xobject.DoAttachObject (if we ! return false, then it drops on down into that routine). ! This is where we can trap for "tie wagon to bull" and ! re-route it to the inverted version. if (object = wagon, wagon_hitch, wagon_axles) { Perform(verbroutine, xobject, object) !Swap. Route. } else { return false !Fall on out to do default handling. } } xobject DoAttachObject { if (object = harness) { !Re-route through the "put harness on bull" method. Perform(&DoPutIn,object,self) } elseif (object = rope) { if (harness in bull) { if IsAttached(rope, harness) { !It's already attached to the harness. PrintMessage(4,14,3) !Pretty much already tied on. } else { Message(&parse,2) !"(assuming you mean...)" " to tie it to the harness)" perform(&DoTie,object,harness) !Redirect to harness. } } else { PrintMessage(4,14,2) !Can't tie rope directly to bull. } } else { PrintMessage(3,2,1) !You can't do that: generic message works } } object DoTouch { if (grain not in trough) { PrintMessage(6,8,0) !Can't get close enough yet. } else { !Because just tapping the bull doesn't really help. return false !Nothing happens. } } object DoHit, DoKick, DoShake, DoPush { if (xobject is sharp) { !Let this fall through to default handling, for now. return false !Player's trying to "cut" the bull. } elseif (grain not in trough) { PrintMessage(6,8,0) !Can't get close enough yet. } elseif (harness in bull) and IsAttached(rope,harness) { if IsAttached(rope,wagon_hitch) { if (wheel in wagon) { !Everything's good. It'll work. So remove things. wagon.found_on = nothing !removes the normal wagon. bull.found_on = nothing !The bull is gone too. remove(rope) !The rope is gone now, as well. PrintMessage(6,8,5) !The bull pulls the wagon. PrintMessage(7,2) !The bull pulls the wagon away. AddScore(19) !For blocking the northwest exit. } else { !Woops, it's set up, but the wheel is missing! PrintMessage(6,8,4) !Can't, if wheel is missing. } } elseif Contains(player,rope) { !The player is holding the other end. PrintMessage(6,8,3) !It trots away with rope, returns. move rope to location !Because we've dropped it here. } else { PrintMessage(6,8,2) !Trots away, but then it returns. } } else { PrintMessage(6,8,2) !It trots away, but then it returns. } } xobject DoThrowAt { if (object is always_held) or (object.size > 50) { return false !Default handling - can't throw it. } elseif (object = rope) { Perform(&DoLasso,self,rope) !Redirect to DoLasso. } elseif (object.size < 10) { PrintMessage(3,2,17) !The bull takes no notice. print " "; !space before saying the next part. PrintMessage(4,16,5) !Object falls to the ground. print newline !Because 4,16,5 doesn't line-feed. move object to location !Because we dropped it. } else { if (grain in trough) { if (harness in bull) and IsAttached(rope,harness) { if IsAttached(rope,wagon_hitch) { if (wheel in wagon) { !Everything's good. It'll work. So remove things. PrintMessage(6,8,6) !Throw hits the bull. move object to location !We dropped what we threw PrintMessage(4,16,5) !Object falls to the ground. print " "; !Print a spacer before the next part. wagon.found_on = nothing !removes the normal wagon. bull.found_on = nothing !The bull is gone too. remove(rope) !The rope is gone now, as well. PrintMessage(6,8,5) !The bull pulls the wagon. PrintMessage(7,2) !The bull pulls the wagon away. AddScore(19) !For blocking NW exit. } else { !Woops, it's set up, but the wheel is missing! PrintMessage(6,8,4) !Can't, if wheel is missing. } } elseif Contains(player,rope) { !The player is holding the other end. PrintMessage(6,8,6) !Throw hits the bull. move object to location !Also dropped what we threw. PrintMessage(4,16,5) !Object falls to the ground. print " "; !Print a spacer before the next part. PrintMessage(6,8,3) !It trots away with rope, returns. move rope to location !Because we've dropped it here. } else { PrintMessage(6,8,6) !Throw hits the bull. move object to location !Also dropped what we threw. PrintMessage(4,16,5) !Object falls to the ground. print " "; !Print a spacer before the next part. PrintMessage(6,8,2) !Trots away, but then it returns. } } else { PrintMessage(6,8,6) !Throw hits the bull. move object to location !Also dropped what we threw. PrintMessage(4,16,5) !Object falls to the ground. print " "; !Print a spacer before the next part. PrintMessage(6,8,2) !It trots away, but then it returns. } } else { !We can antagonize the bull, but it'll chase us. move object to location !We've dropped it. PrintMessage(6,8,6) !Thowing something at the bull. PrintMessage(6,8,7) !And then it chases the player. perform(&DoGo, s_obj) !Player runs away, leaves obj. } } } xobject DoGive { if (object = harness) { !Assume the player wants to put it on the bull. word[1] = "put" !For the print mesasge to work. PrintMessage(6,2,"the harness on the bull") Perform(&DoPutIn,object,self) } else { return false } } !Trap for things that just wouldn't make sense when done to bull. object DoBreak { PrintMessage(3,2,1) !You can't do that. } } } !---------------------------------------------------------------------------- ! I should probably implement "legs" and "neck" since it's mentioned in the ! "lasso" attempt, but I'm not going to. Players will just have to accept ! that I can't implement everything about everything that's mentioned. ! component bull_horns "bull's horns" { inherits game_scenery !Provides handling for the description. nouns "horn", "horns" adjectives "bull", "bull's", "long", "pointed", "curved" article "the" is plural part_of bull before { object DoGet,DoPush,DoPull,DoHit,DoAttack { if (xobject = nothing) { PrintMessage(10,self,1) !Nope. Bull might gore you instead. } else { return false !Default handling if "with object" is given. } } xobject DoThrowAt { !Treat these verbs as done to the bull itself. perform(&DoThrowAt,object,bull) !Redirected. } } } !---------------------------------------------------------------------------- scenery trough "feeding trough" { inherits game_scenery !Provides handling for the description. !The only reason I'm adding "bin" as a noun is I keep trying to type !that when I mean "trough" (there is a bin in the barn). Oh well. :) nouns "trough", "basin", "bin" adjectives "long", "feeding", "wooden" article "the" found_on hill is container capacity 200 !We will put the feed "in" the trough. holding 0 !Will get auto-calculated list_contents { PrintMessage(6,7,2) !Custom content listing for the trough. } before { !Not necessary, now that I use the list_contents to do it. !object DoSearch, DoLookIn { ! PrintMessage(6,7,2) !Custom list-contents of trough. !} } } !---------------------------------------------------------------------------- ! I thought about making the barn and its door "distant" (since, really, ! the player's position in the game isn't all that close to it), but I ! have decided not to. There really isn't any real interaction required from ! the outside, so there is probably more harm in confusing the player that ! "it's too far away" than there would be in just allowing interactions. ! scenery big_barn "big barn" { inherits game_scenery !Provides handling for the description. nouns "barn", "shed", "shack", "stable", "stables", "side", "sides" adjectives "big", "large", "gray", "grey", "wood-planked" article "the" found_at house, hill, orchard is searched_indirectly !Because we can only "see" to search it. before { object DoEnter, DoGo, DoApproach { perform(&DoGo, in_obj) !Go inside. } } } !---------------------------------------------------------------------------- scenery barn_windows "barn windows" { inherits game_scenery !Provides handling for the description. nouns "windows", "window" adjectives "barn", "barn's", "two", "small", "loft", "both" article "the" is plural, distant, openable, not open is container, transparent !So "look in windows" will work. capacity 1 !Nothing actually fits in the windows. found_in loft, house, hill door_to { if (location = house) { ! The distant_loft object will check for location, and not ! let the player enter from out here. It's out of reach. perform(&DoEnter, distant_loft) } else { if (self is not open) { PrintMessage(6,6,self) !"(Opening the windows first) self is open !Instead of routing through verb routine. } PrintMessage(9,self,1) !It doesn't look very safe, so no. } } before { object DoLookThrough, DoLookIn { PrintMessage(2,self,2) !Message about looking through windows. } object DoExit, DoClimb { if (location = loft) { Perform(&DoEnter, self) !Really meant to "go out" them. } else { return false !Default handling. } } object DoLift { if (self is distant) { return false !Default handling -- too far away. } else { perform(&DoOpen, self) !They lift open. } } xobject DoPutIn { ! If the player is trying to put the beam in, then give an ! appropriate response. if (self is distant) { return false !Windows are too far away. } elseif (location = loft) and (object = beam) { PrintMessage(12,beam,4) !Can't put it through windows. } else { } } } } !---------------------------------------------------------------------------- scenery farm_house "farm house" { inherits game_scenery !Provides handling for the description. found_at house nouns "house", "farm-house", "farmhouse", "dwelling" adjectives "farm", "two", "story", "two-story", "modest" article "the" is searched_indirectly !Because we can only "see" to search it. before { object DoEnter, DoGo { PrintMessage(9,self) !You can't go inside. } } } !---------------------------------------------------------------------------- scenery hatch "cellar hatch" { inherits game_scenery !Provides handling for the description. !MISC #1 - Number of times we attempted to come up carrying the wheel. misc 0 found_in barn, cellar nouns "hatch", "door", "trap-door" adjectives "hatch", "cellar", "trap", "square" article "the" is openable, not open door_to { if (location = cellar) { !First, check for conditions which prevent us from going up. if Contains(player,wheel) { if Contains(player,rope) and IsAttached(rope,wheel) { PrintMessage(6,10,wheel) !Dropping the wheel first. move wheel to location } else { PrintMessage(9,location,1) !Can't climb holding wheel. return true !Because we don't actually go up. } } elseif Contains(player,rope) and IsAttached(rope,wheel) { if (wheel is not moved) { !If the wheel is still on the contraption, we can't go. PrintMessage(9,location,2) !Holding rope. Can't climb. move wheel to location !But the wheel does pop off. wheel is not hidden wheel is moved !Because it's now off the machine. AddScore(14) !For disloding the wheel. return true !Because we don't actually go up. } } SheatheSword !Make sure we put the sword away first. return barn } else { if (IsAttached(rope) = hatch_handle) { PrintMessage(9,barn,d_obj) !It's tied closed. return true !Don't need to print anything else. } elseif (girl in location) { PrintMessage(8,girl,6) !Can't, with the girl here. return true !Don't need to print anything else. } elseif (self is not open) { SheatheSword !Make sure we put the sword away first. DropTheObject(wheel) !Make sure we don't take the wheel. DropTheObject(beam) !It's too big to carry down with us. PrintMessage(6,6,self) !Opening the cellar hatch first if (bees.found_in ~= cellar) { perform(&DoOpen, self) return self.door_to !Return linked room. } else { !Still need to open it so bees come out. perform(&DoOpen, self) return true !Because we don't actually enter. } } else { ! We do this again here, in case the player *didn't* have ! to auto-open the hatch before going down. Otherwise, we ! get the auto messages showing after opening the hatch, and ! that makes less sense when you think about it logically. SheatheSword !Make sure we put the sword away first. DropTheObject(wheel) !Make sure we don't take the wheel. DropTheObject(beam) !It's too big to carry down with us. return cellar !It leads down to the cellar. } } } before { ! Be careful here with verbs for the hatch. When player is in the ! cellar, the hatch becomes "distant" so nothing should be working. object DoOpen { if (IsAttached(rope) ~= hatch_handle) { ! We can allow it. It's not tied closed. ! This also allows for distant-checking to work. return false } else { !We can't. It's tied shut with the rope. PrintMessage(9,barn,d_obj) !It's tied closed. } } object DoPull, DoLift { ! This will work too. When it's distant, it's too far away. Perform(&DoOpen, self) !Pulling/Lifting hatch = opening it. } object DoPush { ! This will work too. When it's distant, it's too far away. Perform(&DoClose, self) !Pushing hatch = opening it. } xobject DoCutOff,DoAttachObject,DoDetachObject,DoGetFrom { !Redirect these verbs to the "handle" instead. perform(verbroutine, object, hatch_handle) } } after { object DoOpen { PrintMessage(12,hatch) !Opening the hatch message. if (bees.found_in = cellar) { !We'll already have printed text about them in PrintMessage. bees is moved !Now, they're gone and away. bees is known !So player can refer to them now. AddScore(13) !For releasing the bees. } return true !So default "opened" message doesn't print. } } } !---------------------------------------------------------------------------- component hatch_handle "hatch's handle" { inherits game_scenery !Provides handling for the description. nouns "handle" adjectives "hatch", "hatch's" article "the" part_of hatch before { object DoPull, DoLift { perform(&DoOpen, hatch) !Pulling/lifting the handle = open hatch. } xobject DoAttachObject { if (hatch is open) { !There is a librarary VMessage we can use for this. !VMessage(&DoLock, 2) !You'll have to close it first. !On second though, we should be more specific. !On third though, let's just imply a "closing" first. !! PrintMessage(3,17) !Can't tie hatch while it's open. PrintMessage(6,9,hatch) !(Closing the hatch first) hatch is not open } return false !allowed, or default handling. } } } !---------------------------------------------------------------------------- ! Why scenery? Well, I want to describe them in conjunction with the girl, ! not as separate parts of the room listing. So... scenery works well enough. ! How do we know when the bees are on the loose? Well, we'll "move" them. ! scenery bees "swarm of bees" { inherits game_scenery !Provides handling for the description. inherits animal !To trap for attempts to talk, ask, show, give, etc. !MISC #1 = bees have gone to the girl. misc false nouns "swarm", "bees", "insects", "cloak" adjectives "swarm", "living", "black", "swarming" article "a" is living, plural, unholdable, searched_indirectly pronouns "they", "them", "their", "themselves" found_in { if (self is moved) { if (self.misc #1) { !Bees have been released from the cellar, and on girl. return parent(girl) !They're wherever the girl is. } else { !If bees are released but we haven't seen the girl yet. return nothing !They're nowhere. } } else { ! This doesn't matter, really. We can never be down ! there when the bees are. I just do a lot of stuff ! like this, simply to form a complete world model. return cellar !Initially, they're down in the cellar. } } before { object DoKick, DoHit, DoBreak, DoAttack, DoCut, \ DoStab, DoProvoke { PrintMessage(2,self,2) !Best not provoke them. } object DoGet, DoEat { PrintMessage(3,2,10) !If your own safety was less important. } object DoHello, DoTalk, DoTell, DoAsk, DoAskQuestion { !There is an alternate of this in "animal" class: (17,2,obj). PrintMessage(2,self,3) !They lack the intelligence to comprehend. } xobject DoThrowAt { if (object.size <= 50) { PrintMessage(2,self,2) !Best not provoke them. } else { return false !It's too big to throw. } } xobject DoShow { PrintMessage(2,self,3) !They lack the intelligence to comprehend. } } } !---------------------------------------------------------------------------- scenery distant_orchard "orchard" { inherits game_scenery !Provides handling for the description. nouns "orchard", "trees", "tree" adjectives "apple" article "the" is distant is full_named !fixes "search for apple" ambiguity in message. found_at house before { object DoEnter, DoGo, DoApproach { perform(&DoGo, s_obj) !Attempt to go south. } } } !---------------------------------------------------------------------------- scenery sunlight "sunlight" { inherits game_scenery !Provides handling for the description. nouns "sun", "light", "sunlight" adjectives "sun" found_in barn is unholdable } !---------------------------------------------------------------------------- scenery barn_walls "walls" { inherits game_scenery !Provides handling for the description. !Some of the nouns are also adjectives -- for instance "gaps in wall" !Or "barn walls" will also work, since "barn" is an adjective too. nouns "walls", "wall", "slat", "slats", "plank", "planks", "sides" adjectives "wood", "plank", "wood-plank", "sturdy", "tall", \ "eastern", "western", "northern", "southern", \ "gray", "grey", "barn" article "the" is plural found_in barn !Because these are the walls of the barn. before { object DoSearch { if (xobject = nothing, barn_southexit) and \ (barn_southexit is not known) { PrintMessage(2,self,2) !Player finds the southwest exit. } else { return false !Default "nothing else" message. } } } } !---------------------------------------------------------------------------- ! There's no *real* reason the wall gaps need to be a separate scenery ! object from the barn walls. Basically, I'm doing it so that there isn't ! noun/adj confusion when trying to combine them both into one object. ! component barn_gaps "wall gaps" { inherits game_scenery !Provides handling for the description. !Some of the nouns are also adjectives -- for instance "gaps in wall" nouns "gap", "gaps", "slices", "light", "sliver", "slivers" ! So we can say "wall gaps" and "slivers of light" adjectives "small", "wall", "slat", "slivers", "narrow" article "the" is plural, unholdable part_of barn_walls !These are a part of the walls of the barn. } !---------------------------------------------------------------------------- scenery tackle "livestock tackle" { inherits game_scenery !Provides handling for the description. ! The first noun and the first adjective are temporory. I'll set them to ! blank (to avoid ambiguity) once the player has found the harness. The ! reason I put them here, though, is if a player *knows* the harness is ! on the wall, they might try "get harness" and wonder why it fails. nouns "harness", "tackle", "gear" adjectives "leather", "cattle", "livestock", "lifestock" article "the" found_in barn before { object DoGet { if (harness is moved) { PrintMessage(10,self) !None of the rest of it interests you. } else { PrintMessage(11,self) Acquire(player, harness) RemoveProp(self,nouns,"harness") !No more "harness" as noun. RemoveProp(self,adjectives,"leather") !No more "leather". set_pronoun_to = harness !So we can "x it" or whatever. AddScore(23) !For discovering the harness. } } object DoSearch { if (xobject = nothing, harness, self) { ! Here's if we "search gear for harness" ! Or if we "search gear" (for nothing). if (harness is not moved) { Perform(&DoGet, self) } else { return false !We don't find it there now. } } else { return false !Default handling. } } xobject DoSearch { if (object = nothing) and (harness is not moved) { !We did a "search for harness" in the barn. Perform(&DoGet, self) } else { return false !Default handling } } } } !---------------------------------------------------------------------------- scenery storage_bin "storage bin" { inherits game_scenery !Provides handling for the description. nouns "bin", "box" adjectives "long", "narrow", "wooden", "wood", "storage" article "the" found_in barn is openable, not open, container capacity 200 !We can put stuff in it, but no real need to. holding 0 !Will get auto-calculated before { object DoSearch, DoLookIn { if (self is not open) { PrintMessage(6,6,self) !Opening the storage bin first AddScore(17) !For discovering the grain. self is open } return false !Always pass on through to the default handling. } object DoLift { perform(&DoOpen, self) !lifting the bin = opening the lid. } object DoClimb, DoGo, DoEnter, DoStandOn { if (verbroutine = &DoClimb) or IsWord("on") or IsWord("onto") { PrintMessage(9,self) !Climb up, nothing reach, climb down. } else { return false !Default handling. } } object DoMove, DoPush, DoPull { !Attempting to move it over, eh? Well, we'll trap for that. PrintMessage(12,self,2) !Attempting to push or move or pull. } xobject DoPutIn { ! Now, I could just make the "capacity" of the bin smaller, and ! the "size" of the wheel bigger, but I don't want to see the ! message "there's no room." I could probably customize the ! message, but this should work just as well. Say it won't fit. if (self is not open) { PrintMessage(6,6,self) !Opening it first. perform(&DoOpen,self) !So contents will show. } if (object = wheel, beam) { !Regardless of the fact that technically the size/capacity !check *would* let it fit. It's just doesn't "fit" there. :) PrintMessage(4,12,object) !It wont' fit. } else { return false } } } after { object DoOpen { PrintMessage(12,self,1) !Open storage bin. AddScore(17) !For discovering the grain. return true !So default message doesn't print. } } } !---------------------------------------------------------------------------- scenery barn_cask "cask" { inherits game_scenery !Provides handling for the description. !MISC #1 = The player has taken a notch out of the side of it. misc false !Currently unused? nouns "cask", "barrel" adjectives "tall", "wooden", "cider" article "the" found_in barn is openable, not open, container capacity 100 !We can put stuff in it, but no real need to. holding 100 !Assume it's full of liquid from the start. before { object DoSniff { PrintMessage(13,self,1) !It smells like cider } object DoOpen { ! I'm tempting to say *why* there is no good way to do it -- no ! lid, solid build, etc. But, I'm afraid this *might* make the ! players think that opening it important. And it's sorta not. PrintMessage(3,2,5) !You see no good way to do that. } object DoSearch { ! first make sure we're not searching "for" something. if (xobject = nothing) { if (self is not moved) { PrintMessage(2,self,2) !Something's behind it. } else { return false !Default handling. } } else { return false !Default handling. "It's not there." } } object DoLookBehind { if (self is not moved) { ! Here's a pretty good clue that should help most players. ! I *could* auto-move the cask if the player has made it ! this far, but this might be making the wrong assumption. PrintMessage(2,self,3) !Can't see with barrel in way. } else { !We see the cabinet. So print the "see cabinet" message. PrintMessage(12,self,2) ! A cabinet is there. } } object DoMove, DoPull, DoPush, DoGet, DoTurn { !We're attempting to move the barrel out of the way. if (self is not moved) { if Contains(player,beam) { PrintMessage(3,25,beam) !Player can't if carrying beam. } else { self is moved !Yeah, we just now moved it. PrintMessage(12,self,1) ! We've found the cabinet! } } else { ! We already found the cabinet. Can't move it again. PrintMessage(12,self,3) !Can't move it any farther. } } } } !---------------------------------------------------------------------------- scenery barn_cabinet "small cabinet" { inherits game_scenery !Provides handling for the description. nouns "cabinet" adjectives "small" article "a" is container, openable, not open capacity 25 !Small capacity, same as sack. holding 0 !Will get auto-calculated found_in { if (barn_cask is moved) { return barn } else { return nothing } } before { object DoPull { ! I don't need to say "assuming you mean to..." because when ! you open it, the text *says* that you pull it open. Right? perform(&DoOpen, self) !Pulling it = opening it. } object DoSearch, DoLookIn { if (self is not open) { PrintMessage(6,6,self) !Opening the cabinet first self is open } if (gate_key in self) { AddScore(22) !For discovering the gate key. } return false !Always pass on through to the default handling. } xobject DoPutIn { if (self is not open) { PrintMessage(6,6,self) !Opening it first. perform(&DoOpen,self) !So contents will show. } if (object = gate_key) { ! Basically, this is just so players won't think that they ! are supposed to put the key back inside, on the off chance ! that they found it at the gate instead, and the description ! is a little misleading to them. Hope it works right! :) PrintMessage(4,15,gate_key) !Can't put it back. } else { return false !So default "put in" continues. } } } after { Object DoOpen { PrintMessage(12,self) !Open cabinet bin. return true !So default message doesn't print. } } } !---------------------------------------------------------------------------- scenery barn_northexit "northwest exit" { inherits game_scenery !Provides handling for the description. nouns "exit" adjectives "northwestern", "northwest", "nw" article "the" found_in barn door_to { if InList(wagon,found_on,hill) { if (location = hill) { !First, check to see if the rope is attached to something. rnd = false !A flag just for this little bit. if IsAttached(rope, wagon_hitch): rnd = true if (harness in bull) and \ IsAttached(rope, harness): rnd = true if Contains(player,rope) and (rnd) { !Set temporary flag for benefit of PrintMessage(9,hill). hill.misc #1 = true !This is our temporary flag. return nothing } else { return barn } } else { DropTheObject(beam) !It's too big to carry out with us. return hill } } else { return false !Can't go that way. } } } !---------------------------------------------------------------------------- ! There are two ways to discover this exit. The player can either find it ! by looking at (searching?) the barn walls from inside (but that's not very ! likely unless they already know to do so), or when the girl uses this ! entrance to enter the barn. ! scenery barn_southexit "southwest exit" { inherits game_scenery !Provides handling for the description. ! I wanted to use "side" as an adjective (for "side entrance") but ! "side" is also used as a reference to the barn itself sometimes. ! Noun #1 is either "exit" or "entrance" depending on the room. ! Noun #2 is either "outline" or "door" depending on room. ! Noun #3 goes away when we're in the orchard. ! Adjs #1, #2, and #3 (directions) change based on location. ! Adjs #4 is either "exit" or "entrance" depending on the room. ! Adjs #5 is either "thin" or "barn's" depending on the room. ! Adjs #6 is either "rectangular" or "bulky" depending on room. nouns "exit", "outline", "rectangle", "panel" adjectives "southwestern", "southwest", "sw", "exit", \ "thin", "rectangular", "solid", "wooden" article "the" found_in nothing, orchard !Gets found_in barn, once we notice it. is not known !Should be "not known" by default. But, be sure. is openable, not open door_to { if (self is not open) { if (location = orchard) { PrintMessage(6,6,self) !Opening the panel first. Perform(&DoTurn, pulley_system) } } !See if it's open now, after possible actions above. if (self is open) { if (location = barn) { DropTheObject(beam) !It's too big to carry out with us. return orchard !Enter the orchard. } else { return barn !Enter the barn. } } else { return nothing !It's not open. } } parse_rank { if (verbroutine = &DoLift, &DoOpen, &DoClose, \ &DoPush, &DoPull, &DoMove) { return 1 !These verbs are intended for the southwest exit. } else { return 0 !Default parse rank, so we'll need disambiguation. } } before { object DoLift, DoOpen, DoClose, DoPush, DoPull, DoMove { if (location = barn) { ! Handle all cases here, because sometimes "push" means "open", ! and other times it means "close" depending on whether or not ! the exit panel is already open. So, handle it all from here. if (self is open) { if (verbroutine = &DoOpen, &DoLift) { PrintMessage(3,2,19) !Response: It's already open. } else { PrintMessage(12,self,2) !Response: Can't close inside. } } else { if (verbroutine = &DoClose) { PrintMessage(12,self,3) !Response: It's already closed. } else { PrintMessage(12,self,4) !Response: Can't open inside. } } } else { ! Handle these cases when we're out in the orchard. if (verbroutine = &DoPush, &DoPull, &DoMove) { PrintMessage(12,self,4) !It can only be moved w/pulley. } elseif (self is open) { if (verbroutine = &DoOpen, &DoLift) { PrintMessage(3,2,19) !It's already open. } else { !This will cause it to close. if (pulley_system.misc #1) { ! Only print this after they've noticed it. Message(&parse,2) !"(assuming you mean...)" " to turn the pulley)" } perform(&DoTurn, pulley_system) } } else { if (verbroutine = &DoClose) { PrintMessage(3,2,19) !It's already closed. } else { !This will cause it to open. if (pulley_system.misc #1) { ! Only print this after they've noticed it. Message(&parse,2) !"(assuming you mean...)" " to turn the pulley)" } perform(&DoTurn, pulley_system) } } } } } } !---------------------------------------------------------------------------- scenery rocking_chair "rocking chair" { inherits game_scenery !Provides handling for the description. nouns "chair", "rocking-chair" adjectives "rocking", "wooden", "old", "weathered" article "the" in porch !on it, actually, but that's close enough. before { object DoSit, DoEnter { PrintMessage(9,self,1) !Sit, or attempt to sit, at least. } } } !---------------------------------------------------------------------------- scenery porch "front porch" { inherits game_scenery !Provides handling for the description. nouns "porch", "deck", "platform" adjectives "short", "flat", "front", "wooden" article "the" found_at house before { !Should we trap for "DoPutIn" in case player tries to "put" stuff? !Maybe do that later. We'll see. leaving this comment as a reminder. !xobject DoPutIn { !} object DoEnter, DoGo { PrintMessage(3,5,self) !You're already there. } } } !---------------------------------------------------------------------------- scenery blossoms "apple blossoms" { inherits game_scenery !Provides the long_desc handling. nouns "blossom", "blossoms" adjectives "pink", "white", "apple" article "the" found_in orchard before { object DoGet { PrintMessage(10,self,1) !It turns to dust and blows away. } } } !---------------------------------------------------------------------------- ! Note that this isn't the "plural_class" because the only thing we really ! need to do is distinguish between "one tree" and "all the trees". ! scenery apple_trees "apple trees" { inherits game_scenery !Provides handling for the description. inherits apple_tree_redirs !Redirects verbs to single apple tree. nouns "trees", "apples" adjectives "apple" article "the" is plural is searched_indirectly is full_named !Because "apple" can be ambiguous with apple object. found_in orchard before { xobject DoSearch { if (object = nothing) and (IsWord("apples")) { !User typed something similar to "search for apples" if (apple in apple_tree) or (apple is concealed) { Perform(&DoSearch,nothing,apple) !Search For Apple. return true !Nothing else needs to be done. } } return false !All else covered by other/default conditions. } xobject DoGetFrom { !Trying to get anything from the "trees" should be taken to !mean we want to get something from the single tree. Perform(&DoGetFrom,object,apple_tree) } object DoGet { ! We'll assume the player tried to "get apples" and it triggered ! on the tree by mistake, if the apple hasn't been found. Note ! that "get apple" will trigger on the single tree, so we don't ! need to check for the adjective if (apple is concealed) and (IsWord("apples")) { if (not IsWord("tree") and not IsWord("trees")) { PrintMessage(2,apple_tree,3) !Searching tree first. print " "; !Spacer before the next section. PrintMessage(10,apple,2) !It's out of reach here. return true !So we don't fall through to default. } } if (FindObject(apple,location) > 0) { Perform(&DoGet, apple) !Assume player means the apple. } else { Perform(&DoGet, apple_tree) !Attempt to get the single tree. } } } } !---------------------------------------------------------------------------- scenery apple_tree "apple tree" { inherits game_scenery !Provides the long_desc handling. !MISC #1 = player has attempted to climb the tree once. misc false !Note that "tree" is an adjective so "tree trunk" will work right. nouns "tree", "trunk" adjectives "apple", "one", "single", "tree" article "the" found_in orchard parse_rank 2 !To avoid possible ambiguation with "apple trees" is searched_indirectly is full_named !Because "apple" can be ambiguous with apple object. before { xobject DoGetFrom { if (object = self) { ! We're going to assume the player didn't really mean ! to get the tree from itself, in the case below. if (apple is concealed) and (IsWord("apple")) { PrintMessage(2,self,3) !Searching the tree first. print " "; !Spacer before next section. PrintMessage(10,apple,2) !It's out of reach here. return true !So default doesn't trigger, below. } } elseif (object = apple_trees) { ! We're going to assume the player didn't really mean ! to get the trees from the tree, in the case below. if (apple is concealed) and (IsWord("apples")) { PrintMessage(2,self,3) !Searching the tree first. print " "; !Spacer before next section. PrintMessage(10,apple,2) !It's out of reach here. return true !So default doesn't trigger, below. } } return false !Default handling. } xobject DoSearch { if (object = self, apple_trees) { ! We're going to assume the player didn't really mean ! to search the tree for itself, in this case. if (apple is concealed) and (IsWord("apple")) { Perform(&DoSearch,self) !Search Apple Trees return true !No default handling. } } if (object = nothing) { ! We're going to assume the player didn't really mean ! to search for the tree itself, in this case. if (apple is concealed) and (IsWord("apple")) and \ (not IsWord("tree")) and (not IsWord("trees")) { Perform(&DoSearch,nothing,apple) !Search For Apple. return true !No default handling. } } return false !Default handling for any other scenarios. } object DoSearch { if (apple in self) or (apple is concealed) { if (xobject = nothing,apple) { ! This is said whether or not the player has seen it before. ! That way, repeated searching doesn't say "you find nothing ! new" until the apple is gone from the tree. PrintMessage(2,self,3) !We spot the apple. print newline !To end the line. return true !Don't do the default. } if (xobject = apple_trees) and (IsWord("apples")) { ! Assume "search tree for apples" (where apples is ! another way of referring to the tree collection) ! is actually an attempt to find apples in the tree. PrintMessage(2,self,3) !We spot the apple. print newline !To end the line. return true !Don't do the default. } } return false !Default handling for anything else. } object DoGet { !We'll assume the player tried to "get apple" and it triggered !on the tree by mistake, if the apple hasn't been found. if (apple is concealed) and (IsWord("apple")) { if (not IsWord("tree") and not IsWord("trees")) { PrintMessage(2,self,3) !Searching the tree first. print " "; !Spacer before next section. PrintMessage(10,apple,2) !It's out of reach here. return true !So we don't fall through to default. } } PrintMessage(10,self,1) !You can't take the whole tree. } !These are things that would require approaching the tree. And as !a result, any of these things could startle the girl. object DoTouch { if (girl.misc #1) { PrintMessage(12,self,5) !Nothing happens when you tap it. } else { PrintMessage(8,girl,3) !Beginning of cutscene. PrintMessage(7,3) !The actual cutscene text. } } object DoApproach { if (girl.misc #1) { return false !It's okay to approach the tree. } else { PrintMessage(8,girl,3) !Beginning of cutscene. PrintMessage(7,3) !The actual cutscene text. } } object DoClimb { if (girl.misc #1) { if (self.misc #1) { !We've already tried climbing the tree. PrintMessage(12,self,4) !It won't support you. } else { !Climbing for the first time - or trying to. SheatheSword !We have to put the sword away first. PrintMessage(12,self,3) !We try, but it won't work. self.misc #1 = true !Player has attempted to climb. if (apple is not moved) { apple is not concealed !Apple is visible. move apple to location !And it's in room. apple is moved !And it's now flagged mov. } } } else { PrintMessage(8,girl,3) !Beginning of cutscene. PrintMessage(7,3) !The actual cutscene text. } } object DoStab, DoCut { if (girl.misc #1) { if (xobject = nothing,sword) { !Draw the sword if needed. if (MakeReadySword) { PrintMessage(5,10,1) if (apple is moved) { PrintMessage(12,self,1) !Nothing happens. } else { PrintMessage(12,self,2) !Apple falls out. apple is not concealed !Apple is visible. move apple to location !And it's in room. apple is moved !And it's now flagged mov. } } } else { return false !Default handling for this. } } else { PrintMessage(8,girl,3) !Beginning of cutscene. PrintMessage(7,3) !The actual cutscene text. } } xobject DoThrowAt { ! If it's less than 50, it's too small to shake the tree. ! If it's greater than 50, it's too big to throw. if (object is always_held) { return false !It's not something that can be thrown. } elseif (object.size = 50) and (apple is not moved) { ! Message is generic enough to work here. PrintMessage(12,self,2) !The apple falls out. move object to location !Drop whatever was thrown. ! And also allow this to set the girl in motion. We can ! stop the player from throwing things at the girl, but ! no way to stop them from throwing stuff at the tree. if (not girl.misc #1) { PrintMessage(8,girl,12) !Alternate beginning. PrintMessage(7,3) !The actual cutscene text. } } elseif (object.size <= 50) and (not girl.misc #1) { ! Handle throwing something at the tree that the girl ! will be able to notice. Not going through default route, ! so we have to mimic the message that prints, first. PrintMessage(4,16,4) !We throw object at xobject. move object to location !It falls to the ground. if (not girl.misc #1) { PrintMessage(8,girl,12) !Alternate beginning. PrintMessage(7,3) !The actual cutscene text. } } else { return false !Default handling. } } object DoShake, DoHit, DoKick, DoMove, DoPush, DoPull { if (girl.misc #1) { if (xobject is sharp) { Perform(&DoCut, self, xobject) } else { if (apple is moved) { PrintMessage(12,self,1) !Nothing happens. } else { PrintMessage(12,self,2) !Apple falls out. apple is not concealed !Apple is visible. move apple to location !And it's in room. apple is moved !And it's now flagged mov. } } } else { PrintMessage(8,girl,3) !Beginning of cutscene. PrintMessage(7,3) !The actual cutscene text. } } } } !---------------------------------------------------------------------------- component apple_tree_branches "branches" { inherits game_scenery !Provides the long_desc handling. inherits apple_tree_redirs !Redirects verbs to apple tree itself. nouns "branch", "branches", "limb", "limbs" adjectives "apple", "tree", "high" article "the" part_of apple_tree is plural, distant, searched_indirectly !They're out of reach. is full_named !Because "apple" can be ambiguous with apple object. } !---------------------------------------------------------------------------- component apple_tree_foliage "foliage" { inherits game_scenery !Provides the long_desc handling. inherits apple_tree_redirs !Redirects verbs to apple tree itself. nouns "leaves", "foliage" adjectives "white", "pink" article "the" part_of apple_trees !Consider it part of all the trees. } !---------------------------------------------------------------------------- scenery pulley_system "pulley system" { inherits game_scenery !Provides handling for the description. !MISC #1 = whether or not the player has actually seen the pulley. misc false nouns "system", "chain", "pulley", "pully" adjectives "chain", "pulley", "pully" article "the" found_in orchard before { object DoTurn, DoPush, DoPull, DoMove { if (barn_southexit is open) { PrintMessage(12,self,2) !Close it. barn_southexit is not open if (girl in barn) and \ not get_girl_movement(barn,girl_moving.misc #2) { PrintMessage(12,self,3) !Girl is trapped, but no good. } else { print newline !Nothing else to add. } AddScore(20) !For the first time we close SW exit. } else { PrintMessage(12,self,1) !Open it. barn_southexit is open } !Be sure that the exit will be listed inside. if not InList(barn_southexit,found_in,barn) { barn_southexit.found_in #1 = barn barn_southexit is known !We see it. } } } } !---------------------------------------------------------------------------- ! There is a ladder going down, and a ladder going up, but not necessarily ! visible at the same time (unless player reveals both exits). So, I want ! to make sure they can referred to as "ladder", but that I avoid ambiguity ! when both are present by having one be "steps" and the other be "ladder". ! scenery cellar_steps "steps" { inherits game_scenery !Provides handling for the description. nouns "steps", "stair", "stairs" adjectives "ladder", "ladder-like", "narrow" article "the" found_in { if ((hatch is open) and (location = barn)) or (location = cellar) { return location } else { return nothing !The ladder can't be seen. } } before { object DoClimb, DoEnter, DoGo, DoApproach { if (location = barn) { Perform(&DoGo, d_obj) } else { Perform(&DoGo, u_obj) } } } } !---------------------------------------------------------------------------- ! The implementation for hit/attack/cut and implications seem to be right ! in this object. I could probably use that as a model for similar actions. ! scenery contraption "contraption" { inherits game_scenery !Provides handling for the description. !MISC #1 - has the player "damaged" the device using the sword? misc false !Note that it can be "broken" just by taking the wheel. nouns "contraption", "machine", "device", "base", \ "machinery", "apparatus", "guts", "contrapion" adjectives "large", "big", "complicated" article "the" is platform, container, open, not fixable is switchable !Because testers have tried it. capacity 1 found_in cellar before { object DoSwitchOn, DoSwitchOff { PrintMessage(2,self,3) !Appropriate failure message for this. } object DoSniff { ! There should be enough clues that the player can figure out ! this is (or used to be) used for making apple cider. ! It's not necessary to make any now, though. PrintMessage(13,self,1) !The faint and faded smell of cider. } object DoRepair { if (self is broken) and (xobject = wheel) { Perform(&DoPutIn,wheel,self) !Attempt this verb. } else { return false !Nothing likely to fit - default message. } } object DoCut, DoStab { if (MakeReadySword) { PrintMessage(5,12) !We damage the contraption with sword. contraption is broken } } object DoHit, DoKick { !Only if they specified "with sword" -- otherwise DoHit might !refer to punching, or kicking, or whatever. So, be sure. if (xobject = sword) { perform(&DoCut,object,xobject) } else { !This one is generic enough to be used in other spots, too. PrintMessage(5,11,self) !You punch/kick but nothing happens. } } object DoBreak, DoAttack { if (xobject = nothing) { xobject = sword PrintMessage(6,12,xobject) !"(With your sword)" } if (xobject = sword) { Perform(&DoCut,self,xobject) } else { Perform(&DoHit,self,xobject) } } xobject DoPutIn,DoStrap { if (object = wheel) { PrintMessage(4,17,wheel) !Can't see any way to reattach. } else { if (verbroutine = &DoPutIn) { if (object = apple) { ! I was tempted to allow it, but I'm afraid this might just ! further the player's resolve in thinking that the machine ! is important should should somehow be made to use apples. if (self.misc #1) { PrintMessage(4,9,2) !Can't. It has been broken now. } else { PrintMessage(4,9,1) !Can't put apple in contraption. } } else { !Yeah, it's generic, but it'll do the job. PrintMessage(3,2,5) !You see no good way to do that. } } else { return false !Default handling. } } } } } !---------------------------------------------------------------------------- component wood_paneling "wood paneling" { inherits game_scenery !Provides handling for the description. nouns "wood", "panel", "panels", "paneling", "panneling", "panelling" adjectives "wood", "wooden", "assorted" article "the" part_of contraption before { ! This has to be done for each component, because the "component" ! object declaration would override it if we just put this in an ! inherited class. Oh well. It's a short bit of code, anyway. object DoGet, DoGetFrom, DoPull, DoMove { if (xobject = nothing, contraption) { PrintMessage(10,self,1) !Can't remove the pieces. } else { return false !That isn't where they're at. } } ! Perform these actions to the contraption itself. object DoKick, DoHit, DoBreak, DoAttack, \ DoCut, DoStab, DoRepair, DoSniff { Perform(verbroutine, contraption, xobject) } } } !---------------------------------------------------------------------------- component reed_hoses "reed hoses" { inherits game_scenery !Provides handling for the description. !Just in case somebody misreads "reed" as "red" I'll support that too. nouns "reeds", "reed", "hose", "hoses", "tube", "tubes" adjectives "red", "reed", "reed-like", "reedlike", \ "flexible", "assorted" article "the" is plural part_of contraption before { ! This has to be done for each component, because the "component" ! object declaration would override it if we just put this in an ! inherited class. Oh well. It's a short bit of code, anyway. object DoGet, DoGetFrom, DoPull, DoMove { if (xobject = nothing, contraption) { PrintMessage(10,self,1) !Can't remove the pieces. } else { return false !That isn't where they're at. } } ! Perform these actions to the contraption itself. object DoKick, DoHit, DoBreak, DoAttack, \ DoCut, DoStab, DoRepair, DoSniff { Perform(verbroutine, contraption, xobject) } } } !---------------------------------------------------------------------------- component steel_springs "steel springs" { inherits game_scenery !Provides handling for the description. nouns "steel", "spring", "springs" adjectives "steel", "assorted" article "the" is plural part_of contraption before { ! This has to be done for each component, because the "component" ! object declaration would override it if we just put this in an ! inherited class. Oh well. It's a short bit of code, anyway. object DoGet, DoGetFrom, DoPull, DoMove { if (xobject = nothing, contraption) { PrintMessage(10,self,1) !Can't remove the pieces. } else { return false !That isn't where they're at. } } ! Perform these actions to the contraption itself. object DoKick, DoHit, DoBreak, DoAttack, \ DoCut, DoStab, DoRepair, DoSniff { Perform(verbroutine, contraption, xobject) } } } !---------------------------------------------------------------------------- component thick_cords "thick cords" { inherits game_scenery !Provides handling for the description. nouns "cord", "cords", "hair", "hairs", "fibers", "fibres", "fiber" adjectives "thick", "horse", "horse's", "weaved", "woven" article "the" is plural part_of contraption before { ! This has to be done for each component, because the "component" ! object declaration would override it if we just put this in an ! inherited class. Oh well. It's a short bit of code, anyway. object DoGet, DoGetFrom, DoPull, DoMove { if (xobject = nothing, contraption) { PrintMessage(10,self,1) !Can't remove the pieces. } else { return false !That isn't where they're at. } } ! Perform these actions to the contraption itself. object DoKick, DoHit, DoBreak, DoAttack, \ DoCut, DoStab, DoRepair, DoSniff { Perform(verbroutine, contraption, xobject) } } } !---------------------------------------------------------------------------- ! I mention a TON of stuff when reading the tapestry, and I need to make ! sure it all ends up here, to avoid "you don't see that" messages. ! component tapestry_markings1 "tapestry's markings" { inherits game_scenery !Provides handling for the description. nouns "glyph", "glyphs", "circle", "circles", "swirl", \ "illustration", "illustrations", "loop", "loops", "symbol", \ "symbols", "writing", "liquid", "mug", "glow", "swirls", \ "tree", "trees", "faces", "tyrant", "mark", "people", \ "drawings", "baby", "monster", "girl", "markings", \ "heart", "hand", "part", "marks" adjectives "crude", "angular", "ethereal", "eerie", "tyrant's", "red", \ "smiling", "satisfied", "happy", "connecting", "other", \ "tapestry", "tapestries", "tapestry's", "tapestrys" article "the" is unholdable, readable, plural parse_rank -1 !Make sure it's below the real tapestry. part_of { if (location = cellar): return tapestry else: return nothing } before { object DoRead { !Just looking at the marks won't read them, though. Perform(&DoLook, tapestry) !Redirect reading to x tapestry. } } } !---------------------------------------------------------------------------- ! When we're viewing it from the house, we can't actually see it. It becomes ! concealed *and* the description of it changes. ! scenery distant_loft "loft" { inherits game_scenery !Provides handling for the description. nouns "loft", "partition" adjective "barn's", "loft" article "the" is distant found_in barn, house door_to { if (location = house) { PrintMessage(9,self,1) } else { Perform(&DoGo, u_obj) !Try going upward. } } } !---------------------------------------------------------------------------- ! Note that "latch" isn't a noun for the cellar hatch handle, so it's okay. ! component flat_lever "flat lever" { inherits game_scenery !Provides handling for the description. nouns "lever", "latch", "hinge" adjectives "flat" article "the" is distant part_of { if (location = house) { return nothing } elseif (location = barn) { return distant_loft } else { return loft_ladder } } before { object DoHit { if (location = loft) { !Lower the ladder from above. if (loft_ladder.misc #1) { PrintMessage(12,self,2) !No need. Ladder is down. } else { !We're able to lower it from here. DropTheObject(beam) !We need a free hand for this. PrintMessage(12,self,5) !We have lowered the ladder. loft_ladder.misc #1 = true AddScore(10) !For lowering the ladder. } } else { if (not loft_ladder.misc #1) and (xobject ~= nothing) { Perform(&DoThrowAt,xobject,self) } else { return false !Default handling. } } } object DoLift, DoMove, DoPush, DoPull { if (location = loft) { Perform(&DoHit, self) !Hit the lever. } else { return false !It will be too far away. } } object DoJump { PrintMessage(9,loft_ladder,1) !We can't jump to the ladder. } xobject DoThrowAt { if (location = loft) { PrintMessage(12,self,4) !No need. We're already in the loft. } else { ! Okay, if this is to be a puzzle, and throwing the apple is ! the solution (note that we can also climb the wagon to get ! to the loft, after we move it), then I have to be careful ! about what objects can be thrown. If I've designed this ! whole thing well enough, we shouldn't encounter any objects ! that would be likely substitutes for the apple anyway. if (object = apple) { if (not loft_ladder.misc #1) { PrintMessage(12,self,1) loft_ladder is not distant loft_ladder.misc #1 = true remove apple !It's gone. AddScore(10) !For lowering the ladder. } else { !The ladder is already down. PrintMessage(12,self,2) } } elseif (object is always_held) { return false !Default non-throw handling. } elseif (object.size > 50) { ! Because it's distant, we have to check things that the ! verbroutine would otherwise check, because the verbroutine ! won't get called ("before" trapping is on distant class. PrintMessage(4,16,1) !It's too large to throw } elseif (object.size > apple.size) { PrintMessage(12,self,3) !Throw, but not high enough. move object to location } else { PrintMessage(4,16,4) !Throw it, and it hits the ground. move object to location } } } } } !---------------------------------------------------------------------------- scenery loft_ladder "ladder" { inherits game_scenery !Provides handling for the description. !MISC #1 = has the ladder been lowered? misc false nouns "ladder", "rails" adjectives "loft", "wooden" article "the" is distant !Becomes non-distant after we lower it. found_in barn, loft door_to { if (not self.misc #1) { !The ladder has not been lowered. if (location = loft) { DropTheObject(beam) !Do that before we get started. PrintMessage(6,16,flat_lever) !"(pushing the lever first)" Perform(&DoHit, flat_lever) SheatheSword !We can't have it drawn when we climb down. return barn !And then allow the player to go down. } else { return false !We can't go that way from down here. } } else { if (location = loft) { if contains(player,beam) { return nothing !Can't climb down if holding beam. } else { SheatheSword !We can't have it drawn when we climb. return barn !We can go down the ladder. } } else { SheatheSword !We can't have it drawn when we climb. DropTheObject(wheel) !It's too big to carry up with us. DropTheObject(beam) !It's too big to carry up with us. DropTheObject(grain) !It's too bulky to carry up with us. DropTheObject(harness) !It's too bulky to carry up with us. return loft !We can go up the ladder. } } } before { object DoClimb, DoEnter, DoGo, DoApproach { !Make sure we're attempting to go up or down. if (location = loft) { Perform(&DoGo, d_obj) !Attempt to go downward } else { Perform(&DoGo, u_obj) !Attempt to go upward } } object DoLift, DoMove, DoPush, DoPull, DoGet { if (self is distant) { return false !It's too far away. } else { PrintMessage(12,self,1) !It can't be moved. } } object DoJump { PrintMessage(9,self,1) !We can't jump to the ladder. } xobject DoThrowAt { if (location = barn) and (not self.misc #1) { !assume we mean to hit the lever instead. Perform(&DoThrowAt,object,flat_lever) } else { return false !Default handling for throw-at-ladder } } } } !---------------------------------------------------------------------------- scenery loft_dust "dust" { inherits game_scenery !Provides handling for the description. nouns "dirt", "dust" article "the" found_in loft } !---------------------------------------------------------------------------- scenery distant_roof "barn's roof" { inherits game_scenery !Provides handling for the description. nouns "roof" adjectives "barn", "barn's", "sloping", "unstable" article "the" is distant, platform capacity 1 !We can't actually put anything on it. found_at house, hill, loft before { object DoClimb { if (location = loft) { Perform(&DoClimb, barn_windows) !Redirection to windows. } else { return false !Default handling. } } } } !---------------------------------------------------------------------------- ! From the loft, the player may still want to interact with the barn, to ! drop the beam "into" the barn, or just to reference it or whatever. ! scenery barn_below "barn" { inherits game_scenery !Provides handling for the description. nouns "barn", "shed", "shack", "stable", "stables", "gap" article "the" found_in loft is container, unholdable capacity 1 !This is just a redirection. long_desc { ! Override the default, since we already have this. PrintMessage(2,loft_floor,2) !We look over the edge. } before { xobject DoMove, DoPush { if (beam in location) and (object = beam) { PrintMessage(12,beam,1) !We push it over the edge. beam is moved !Because initial_desc no longer applies. move beam to barn !And now it's down below. AddScore(11) !For dropping the beam down below. } else { return false !Default handling for anything else. } } xobject DoThrowAt { if (object = beam) { PrintMessage(12,beam,2) !We throw it over the edge. move beam to barn !And now it's down below. AddScore(11) !For dropping the beam down below. } elseif (object is not always_held) and \ (object.size <= 50) { ! Let the player know we're assuming to drop it. word[1] = "drop" !For the message to print. if (object is plural) { PrintMessage(6,2,"them over the side") } else { PrintMessage(6,2,"it over the side") } Perform(&DoDropDown, object, self) !Redirect it. } else { return false !Default message for trying to throw. } } xobject DoDropDown, DoPutIn { if (object = beam) { PrintMessage(12,beam,3) !We drop it over the edge. move beam to barn !And now it's down below. AddScore(11) !For dropping the beam down below. } elseif (object is always_held) { return false !Default handling. } else { PrintMessage(4,26,object) !Drop the object over the side. move object to barn !The player dropped it down there. } } } } !---------------------------------------------------------------------------- ! The doors are barred when the beam is "in" the barn_doors. ! scenery barn_doors "barn doors" { inherits game_scenery !Provides handling for the description. !MISC #1 - we have barred the door at least once (used for short message) !MISC #2 - we have unbarred the door 'least once (used for short message) misc false, false found_at house, barn nouns "door", "doors", "double-door", "double-doors", "exit" adjectives "wide", "barn", "double", "barn's" article "the" is openable, open, lockable, not locked, plural, platform capacity 1 !Basically, we will put the "beam" on/in it. ! Make it parse higher than the "gate" to avoid "door" conflicts. ! And so that it's higher than the "trap doop" in the barn, too. parse_rank { ! If the player is referring to is an an "exit" and we're in the ! barn, there is a possible conflict with the other exit(s). But, ! certain verbs make sense only for the doors anyway, so check. if (location = barn) and IsWord("exit") and \ (verbroutine ~= &DoBar, &DoUnbar) { return 0 !Default parse rank } else { return 2 } } door_to { if (beam in self) { ! It would just be too complicated to unbar the doors ! automatically. We'd have to sheathe the sword, drop extra ! items, lift the beam, open the door, then drop the beam. ! It would be a ton of text and lots to check. So, simply ! don't allow the player to go that way when it's barred. return false !We can't go that way. } elseif (self is not open) { if Contains(player,beam) { DropTheObject(beam) !Dropping the beam first, if applicable. PrintMessage(6,17,self) !And then opening the barn doors. } else { PrintMessage(6,6,self) !Opening the barn door first } perform(&DoOpen, self) return self.door_to !Return linked room. } else { if (location = barn) { DropTheObject(beam) !It's too big to carry out with us. return house } else { return barn } } } before { object DoOpen { if (location = barn) and (beam in barn_doors) { PrintMessage(6,18,self) !Unbarring the barn doors first. Perform(&DoUnbar,self) return false !Default handling - we succeed in opening it. } else { if (self is locked) { PrintMessage(9,self,1) !Barn doors barred from other side. } else { return false !Default handling. } } } object DoLock { !Locking the barn doors basically means barring wth the beam. if (location = barn) { Perform(&DoBar,self,xobject) !Redirect } else { PrintMessage(2,self,2) !Can only be barred from inside. } } object DoBar { if (location = barn) { if (xobject = nothing) and Contains(player, beam) { PrintMessage(6,12,beam) !With the heavy wooden beam. xobject = beam !Because that's what we're using now. } if (self is locked) or (beam in self) { PrintMessage(2,self,3) !Doors are already barred. } elseif (xobject = nothing) { !This will set checking on LookForAnswer "with" verb. PrintMessage(3,22,self) !How do you intend to bar it? } elseif (xobject = beam) { !And here, we are successful! if (self is open) { PrintMessage(6,9,self) !Closing the doors first. self is not open } PrintMessage(2,self,4) !Heft the beam to the cleats. self.misc #1 = true !Flag that we barred the door once. move beam to self : self is locked : beam is hidden } else { PrintMessage(2,self,2) !Only with heavy crossbar. } } else { PrintMessage(2,self,2) !Can only be barred from inside. } } object DoUnlock { if (xobject = nothing) { Perform(&DoUnbar,self) !Redirect to unbar the door. } else { return false !That doesn't seem to do the trick. } } object DoUnbar { if (self is locked) or (beam in self) { if (xobject = nothing, beam) { if (location = barn) { SheatheSword !We can't acquire the beam otherwise. DropTheObject(harness) !Can't carry beam if we have. DropTheObject(grain) !Can't carry beam if the have. DropTheObject(wheel) !Can't carry beam if we have. PrintMessage(2,self,7) !Heft the beam from cleats. self.misc #2 = true !Flag we unbarred the door once. Acquire(player,beam) : self is not locked beam is not hidden !Because it's now off the door. } else { PrintMessage(2,self,5) !Can only unbar from inside. } } else { return false !That doesn't seem to do the trick. } } else { PrintMessage(2,self,6) !The doors are not currently barred. } } object DoPush { if (location = barn) { perform(&DoClose, self) !Push it closed, or already closed. } else { perform(&DoOpen, self) !Push it open, or already open. } return true ! No default handling. } object DoPull { if (location = house) { perform(&DoClose, self) !Pull it closed, or already closed. } else { perform(&DoOpen, self) !Pull it open, or already open. } return true ! No default handling. } xobject DoPutIn { if (object = beam) { !An attempt to put beam on/in the door is a DoBar attempt. Perform(&DoBar, barn_doors, object) !Redirection } else { PrintMessage(3,2,5) !You see no good way to do that. } } } after { object DoOpen { !This assumes it was successfully opened. PrintMessage(12,self) !You open the door. } object DoClose { !This assumes it was successfully closed. PrintMessage(6,3,self) !You close the door. } } } !---------------------------------------------------------------------------- ! We need to allow both "put bar on cleats" and "put bar in cleats". component door_cleats "cleats" { inherits game_scenery !Provides handling for the description. nouns "cleats", "cleat", "hooks", "hook" adjectives "locking", "wooden", "door", "hook-like" article "the" is plural, platform, container part_of { if (location = barn) { return barn_doors } else { return nothing } } before { object DoBar,DoUnbar { !Any attempt to bar/unbar the cleats is attempt for doors. Perform(verbroutine, barn_doors, xobject) !Redirection } xobject DoPutIn { if (object = beam) { !An attempt to put beam on/in the cleats goes to door. Perform(&DoBar, barn_doors, object) !Redirection } else { PrintMessage(3,2,5) !You see no good way to do that. } } xobject DoGetFrom { if (object = beam) and (object in barn_doors) { !An attempt to put beam on/in the cleats goes to door. Perform(&DoUnbar, barn_doors) !Redirection } else { return false !You don't see that there messaging. } } } } !---------------------------------------------------------------------------- ! This isn't really in the game. It's something the swordsman passed, on ! the way here, which the player *might* feel inclined to reference. ! scenery rock_outcroppings "outcroppings of rock" { inherits game_scenery !Provides handling for the description. nouns "rock", "outcropping", "outcroppings" adjectives "rock", "outcroppings" article "the" is distant, concealed, plural found_on farm_path } !---------------------------------------------------------------------------- ! This isn't really in the game. It's something the swordsman passed, on ! the way here, which the player *might* feel inclined to reference. ! scenery farm_stream "narrow stream" { inherits game_scenery !Provides handling for the description. nouns "stream" adjectives "narrow" article "the" is distant, concealed found_at farm_path } !---------------------------------------------------------------------------- scenery jutting_boulders "boulders" { inherits game_scenery !Provides handling for the description. nouns "boulders", "rock", "rocks" adjectives "low", "jutting" article "the" is unholdable, plural found_at hill } !---------------------------------------------------------------------------- ! ROUTINES SPECIFIC TO PART 1 !---------------------------------------------------------------------------- ! This gets called after printing PrintMessage(7,3) -- the girl is now on ! the move. She starts by going to the barn, and her daemon is activated. ! routine girl_starts_moving { barn_southexit.found_in #1 = barn !Just in case barn_southexit is known !Just in case it wasn't seen. barn_southexit is open !Just in case it wasn't open. move girl to barn !Because that's where she has gone. girl.misc #1 = true !And yes, she sure did notice us. Activate(girl_moving) !Start the girl's moving script. } !---------------------------------------------------------------------------- ! This is used to determine if and where the girl moves. I made this its own ! routine instead of just putting it in the girl's daemon routine, because I ! need to know if she's *going* to move so I can not print her short_desc. ! routine get_girl_movement(loc, numturns) { local exit1 = nothing local exit2 = nothing local exit3 = nothing local exits = 0 !How many exits are available? local newroom = nothing !Which room will she go? select loc case hill { !Exit1 = SouthEast, Exit2 = South if InList(wagon,found_on,hill) { exit1 = barn : exits++ } !The southern exit can never be blocked. exit2 = house : exits++ } case house { !Exit1 = East, Exit2 = South, Exit3 = North if (beam not in barn_doors) { exit1 = barn : exits++ } if (south_gate is not locked) { exit2 = orchard : exits++ } !The northern exit can never be blocked. exit3 = hill : exits++ } case orchard { !Exit1 = NorthEast, Exit2 = North !The pulley system can never be disabled. exit1 = barn : exits++ if (south_gate is not locked) { exit2 = house : exits++ } } case barn { !Exit1 = NorthWest, Exit2 = SouthWest, Exit3 = West if InList(wagon,found_on,hill) { exit1 = hill : exits++ } if (barn_southexit is open) { ! Note that we don't have to check if it's jammed/locked. ! From the inside, she has no way to open it, if closed. exit2 = orchard : exits++ } if (beam not in barn_doors) { exit3 = house : exits++ } } if (exits = 0) { return nothing !She's trapped here. } ! If there is more than one exit, she'll try to go right away. ! Or, if more than 3 turns have passed, she'll still run away. if (numturns >= girl_moving.misc #2) or (exits > 1) { if (exits = 1) { if (exit1 ~= nothing) newroom = exit1 elseif (exit2 ~= nothing) newroom = exit2 elseif (exit3 ~= nothing) newroom = exit3 } else { if (old_location ~= exit1) and (exit1 ~= nothing) newroom = exit1 elseif (old_location ~= exit2) and (exit2 ~= nothing) newroom = exit2 elseif (old_location ~= exit3) and (exit3 ~= nothing) newroom = exit3 } } return (newroom) } !---------------------------------------------------------------------------- ! This will attempt to determine if the girl is in an adjacent room. If she ! is, then we'll return a directional object to move toward her. If she's ! not, then we return nothing (the "nothing" object, that is. If she's more ! then one room away, we can't follow her automatically. This can also be ! used to determine which way the girl goes, for printing the "movement" ! messages. In those instances, we should pass in "true" so that we update ! whether she has opened doors in the direction she has gone or is going. ! routine get_follow_girl(newloc, do_open) { local dir = nothing select location case hill { if (newloc = house) { dir = s_obj } elseif (newloc = barn) { dir = se_obj } } case barn { if (newloc = hill) { dir = nw_obj } elseif (newloc = house) { dir = w_obj if (barn_doors is not open) and (do_open) { barn_doors is open !She opened them } } elseif (newloc = orchard) { dir = sw_obj } } case house { if (newloc = hill) { dir = n_obj } elseif (newloc = barn) { dir = e_obj if (barn_doors is not open) and (do_open) { barn_doors is open !She opened them } } elseif (newloc = orchard) { dir = s_obj if (south_gate is not open) and (do_open) { south_gate is open !She opened it } } } case orchard { if (newloc = house) { dir = n_obj if (south_gate is not open) and (do_open) { south_gate is open !She opened it } } elseif (newloc = barn) { dir = ne_obj if (barn_southexit is not open) and (do_open) { barn_southexit is open !She opened it } } } return (dir) } !---------------------------------------------------------------------------- ! Call this when the player has interacted with the girl in a way that may ! cause her to leave the room. Pass the maximum "wait" turns so she'll go ! right away, if she can. These actions are anything physical -- searching ! her, hitting her, trying to give her something -- but not things done ! from a distance, like looking at her or showing her something. ! routine girl_forced_movement { local newroom newroom = get_girl_movement(location, girl_moving.misc #2) if (newroom = nothing) { return false !She has nowhere to go. } else { if (girl.misc #1) { !Note that this is a different counter from the one that happens !when she runs automatically, due to the different clueing here. girl_moving.misc #5 ++ !Increment number of times. if (girl_moving.misc #5 <= 2): rnd = 1 elseif (girl_moving.misc #5 < 4): rnd = random(2) elseif (girl_moving.misc #5 < 6): rnd = random(3) elseif (girl_moving.misc #5 < 8): rnd = random(4) elseif (girl_moving.misc #5 < 10): rnd = random(5) else: rnd = 0 !After ten times, never long. if (rnd = 1) { !Long description for her leaving. PrintMessage(16,3,2) !She sees an exit, and goes that way. PrintMessage(16,location,newroom) !From-To Combination. PrintMessage(16,1) !And, then comes the ending portion. } else { !Short description for her leaving. PrintMessage(16,3,1) !You don't get the chance. PrintMessage(16,2,newroom) !Leaves in a certain direction. } move girl to newroom girl_moving.misc #1 = 0 ! Reset turn counter. } else { !This is the first time she's running. PrintMessage(8,girl,3) !Beginning of cutscene. PrintMessage(7,3) !The actual cutscene text. AddScore(24) !When she first starts running. } return true !Yes, she ran away. } } !---------------------------------------------------------------------------- ! When we know that the key goes to the gate, we call this to change its ! name and to add "gate" as the first adjective. ! routine KeyIsForGate { gate_key.name = "gate key" gate_key.adjectives #1 = "gate" } !---------------------------------------------------------------------------- routine Chapter_End_Part1 { deactivate(girl_moving) !The daemon is done. AddScore(25) !For giving her the pendant. PrintStatusLine !So the score gets updated. PrintMessage(8,self,11) !The girl accepts it. PrintMessage(7,4,1) !And then begin the cutscene. new_pause PrintMessage(7,4,2) !Cutscene part 2 new_pause PrintMessage(7,4,3) !Cutscene part 3 new_pause PrintMessage(7,4,4) !Cutscene part 4 new_pause PrintMessage(7,4,5) !Cutscene part 5 new_pause StartChapter(2) !Move us to Chapter 2 }