Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Persistent variables in Harlowe

Would it be possible to make it so some variables do not reset when you click the back button? And not ALL variables, just specific ones.

I want the main character to be capable of time travel by using the back/forward buttons, so it would be nice if the main character could canonically retain the information learned from doing one thing and then going back and being able to actually use that information without anyone else knowing. Or, for example, if a choice lead to a character dying, you could rewind and your character would think about how they just watched that character die, but changed it so it wouldn't happen.

I know I could probably do this with a fake back button (fake, as in it's not the one that comes with harlowe) but I don't want certain variables to be retained, such as variables stating a character is dead (but you just rewinded to save them) or another character has information, but you just rewinded so they shouldn't have that info anymore. I also don't want to go to the effort of reseting each variable that could possibly change, it's too messy (esp w/ number variables) and too much coding in the passages stresses me out so much

Comments

  • I've tried to do this today. The back button in Harlowe is in fact an "undo button". Maybe I'm wrong, but I think you have to build that "fake back button" yourself and play with variables.

    It may be possible to do something with Javascript, but I can't help you with this.
  • As far as I know, you do have to make a custom 'back'/'rewind' button. Dealing with the variables shouldn't be too difficult, however, since all you need to undo is any changes (except for persistent variables) made in the passage that you're rewinding from.

    e.g. the player clicks to a passage and their friend dies. The only variable being set there is that the friend is dead. So, in the code to go back, the only variable you need to change is their friend's status to alive.

    An advantage to that method is you could set a flag on rewinding indicating that the player saw the friend die, which allows you to show custom text based on that memory - even though the friend is alive and well in the new timeline.

    tldr: You'll need to make a custom back button but you won't need to reset all your variables.
Sign In or Register to comment.