i’ve set up a FOLLOW command that will allow the player to follow an NPC after they leave the room:
(*(room $) is visited)
(understand [follow | $Words] as [follow $NPC])
*(understand $Words as any object $NPC preferably animate)
~(refuse [follow $])
this works great when using the NPC name but it doesn’t work for pronouns (i.e. can’t FOLLOW HER after she leaves the room) as these are cleared as soon as the NPC leaves scope.
within stdlib there is:
(parse $Words as any object $Output $Policy $Someone)
%% The purpose of this branch is to support pronouns, as well
%% as not-here objects that are in scope.
*(parse $Words as single object $Output $Policy $Someone)
~(room $Output)
which would imply that this is SUPPOSED to somehow preserve the pronouns but doesn’t seem to actually do anything as $Output and $Someone are always empty.
i can block (clear all pronouns) manually but then this applies globally, not just FOLLOW. is there a way to preserve pronouns out of scope for a specific command?
(forget pronouns out of scope)
(if) (player's it refers to $Obj) ~($Obj is in scope) (then)
(now) ~(player's it refers to $)
(endif)
(if) (narrator's it refers to $Obj) ~($Obj is in scope) (then)
(now) ~(narrator's it refers to $)
(endif)
(if) (him refers to $Obj) ~($Obj is in scope) (then)
(now) ~(him refers to $)
(endif)
(if) (her refers to $Obj) ~($Obj is in scope) (then)
(now) ~(her refers to $)
(endif)
(if)
(them refers to $ObjList)
*($Obj is one of $ObjList)
~($Obj is in scope)
(then)
(now) ~(them refers to $)
(endif)
I think the cleanest solution is to keep NPCs in scope the turn after they leave the room. (Or just have all NPCs in adjacent rooms in scope, so that players can take a turn to examine something or take inventory before following.)
but then the problem becomes that the player can, for one turn, EXAMINE or TALK TO an NPC that’s out of the room.
i haven’t tried using a custom grammar token; things usually don’t turn out well when i try to delve that deeply into the dialog parser (the parser documentation seems to be the most problematic). not being able to use the pronouns isn’t a big deal but maybe i’ll try that next.
Not necessarily—you can add a (when $Obj is not here) rule so that actions can’t be applied to people in different rooms, and make sure the (refuse $) implementation for your following action doesn’t require the noun to be here.
i have it working now (i think). i was sort of muddling several things together in various combinations, sometimes correctly and sometimes incorrectly. not all are actually needed anyway:
(not here $)
(when $ is not here)
(understand $ as … preferably …)
(action $ requires $ to be present)
this is one of those times i really miss the scope = <Routine> grammar token in inform6.
There is actually a way to do scope=<Routine>, but I’m afraid it won’t help you here—it’ll still use the default scope when deciding whether to discard old pronouns.