Hi, I'm new to Twine and not great with JavaScript. I'm trying to make a maze puzzle game in the form of a "building" (inspired by Christopher Manson's MAZE), with room entrances offered as choices. Once the player has entered a new room, I want the room from which the player arrived to be "locked", with link text deactivated, until the player reaches it from a different path—meaning the player should not be able to go directly backward to a room that has just been visited, but can revisit if the room is offered as an option again at a later time.
I poked around and the lastVisited function looks perfect for this since it can track how many clicks/rooms away from a particular Room X the player has gone.
With a value of -1 being never visited Room X , 0 being in Room X, 1 being just past Room X, and 2 being two turns/clicks past the room, I'd want the link to Room X to deactivate if lastVisited("Room X") is equal to 1. For all other cases, if lastVisited("Room X") is less than 1 or equal to or greater than 2 the link should stay activated or be reactivated. This would have to work for each of around 20 rooms.
How would I implement this?