A TADS3/adv3 module providing a mechanism for tracking Actors' location histories

A simple-ish module for keeping track of the most recent locations Actors have been in: locationHistory github repo.

This just adds a few things to the base Actor class, the important ones being:

Actor

Properties

  • useLocationHistory = nil

    Set to boolean true to track the actors location history. Default is nil.

  • locationHistoryLength = 3

    The number of locations to remember. The actor’s current location is always the last entry in the history, so with the default value of 3 this keeps track of the two locations the actor occupied before their current location.

Methods

  • getLocationHistory()

    Returns a List containing the actor’s location history.

  • getPreviousLocation()

    Returns the most recent location, not counting the current one, that the actor occupied.

The only implementation detail to be aware of is that the location history only cares about location changes. So if an actor loiters multiple turns in a single location the location history won’t be updated. In other words, the location history will never contain the same location twice in a row (unless you manually edit it for some reason).

This is less involved than a lot of stuff I’ve been talking about lately, but seems like it might be useful for generic “player has to move through a set of rooms in a particular order” kinds of puzzles. And it’s just fiddly enough that I want to only have to work out the mechanics once.

2 Likes

What the doctor prescribes for handling players not much responsive/cooperative toward NPC in GuidedTourState (yes, is an issue I noted since the adv3 days of Isekai…)

when the Middle sea is much quieter I’ll look at your code, and see if is adaptable, or at least give good ideas on implementing to, adv3Lite for the happiness of Azuj and Miyai… :wink:

Best regards from Italy,
dott. Piergiorgio.

1 Like

Where were you two years ago when I implemented a similar function?!? :winking_face_with_tongue:. Will be checking out your implementation for improvements. I leaned on enteringRoom() for mine…

1 Like

It’s based entirely on Actor.afterAction(). I think if you want it more bulletproof/global you could alternately have a Schedulable that does a forEachInstance(Actor, ...) every turn.

The reason I didn’t use a polling mechanism based on travel mechanics (like Room.enteringRoom()) is because some of the stuff I want to track this way involves movement-other-than-travel (flip a switch to bamf to a new location, that kind of thing).

1 Like

I think this may be relatively straightforward to implement in adv3Lite. I was planning to do some work on adv3Lite this week in any case, so I’ll take a look at it.

4 Likes