Repeatedly undo until before last decision in twine

Hello! I’m fairly new to twine and trying to offer an option on each passage that undoes until the previous decision the player can make.

I prefer this to having the player press the undo button repeatedly for two clarity-related reasons:

  1. The undo button causes the last link, which would usually be purple to indicate it has already been clicked, to go back to the blue of an unexplored link. I think the link should stay purple in this case, because the player has already seen the passage it leads to.
  2. What part of the story counts as a new passage isn’t intuitive to all players, and some might forget when choices are. These can make it annoying to work out how many times to undo in order to change the outcome in the story. I’m aware that isn’t the only reason to undo, but to me, it’s the main one and should be the easiest.

In my first story, I offered this by a link to the previous decision on each passage, that didn’t actually undo anything. But in my new story, there are variables shown on the sidebar that change in various passages, and such a link should also undo those changes.

For want of some kind of (go-to-undo:) command I’ve been trying to construct a loop that undoes until it encounters a passage tagged ‘choice’. I haven’t been able to get it to work. Is this possible? Am I going about it the right way?

Twine Version: 2.7.1
Story Format: Harlowe 3.3.7
(I’m open to changing story formats if it would make this easier)

Hey! Will preface this by saying I haven’t worked in Harlowe in a while so there may be a much more elegant solution (and apologies if I’ve misunderstood the question too)

I think one solution could be using something like:

(link:"Go to last choice")[(set: $variable to 0)(goto: "last choice passage title")]

(specifics changed to suit your purposes, obvs)

This should allow you to both link back to a previous passage and adjust associated variables to ‘undo’ the effects of choices. Obviously this would have to be implemented manually for each instance where you offered this option and I don’t know whether you had a more automated thing in mind?

In terms of other story formats, if the above solution works for your purposes, it would be much simpler to implement in Sugarcube - that format has setter links so it would look like:

[[Go to last choice|last choice passage title][$variable to 0]]

If I’ve got this wrong or there’s an easier way someone please correct me!

1 Like

Thanks for your advice! That suggestion is very similar to what I did in the first story, and maybe it’s easier to stick close to that. I could focus on writing then! :slightly_smiling_face:

You’re right, though, that I was trying to make it more automated. The reason for that is to account for variable changes that can happen at multiple points, for example when to put on the scarf in the image I’m trying to attach. When undoing from ‘Park’ to ‘Phone Friend’, that might or might not mean taking the scarf off.
(Actually it says I’m not allowed to attach the image :slightly_frowning_face:)

I should probably work around that sort of problem using another variable instead, since automating this sort of undoing seems to be very complicated!
If anyone else has any suggestions though it would be nice to hear.
Thank you!

The (link-reveal-goto:) macro is a better choice when implementing a “Link with Setter” (or “Setter Link”)

(link-reveal-goto: "Go to last choice", "last choice passage title")[(set: $variable to 0)]

2 Likes