Save files remembering some variables... but not others

Twine Version: Harlowe 3.3.7

Hello! I have attempted to implement a save system in Harlowe using the (saved-game:) which is working pretty well… for the most part. My game allows the player to input their character’s name (first and last), gender/pronouns, and personality traits, as well as select the genders of two other characters within the first few passages. These variables use a variety of input methods (cycling links, text input, and regular links). Almost all of the variables are correctly saved once the game has reached a certain point (basically, once everything is set). However, once loaded the name reverts to the default name.

The name is the first variable set, and it reverts regardless of what point I save at, so I don’t think it’s lack of memory. The other variable, which retain their new values, also have default values, so I don’t think it’s just reverting everything to the default.

I’m completely at a loss. Anyone have any advice? I know that Harlowe is maybe not the best at saves, but I have over 300 passages in my project and I don’t want to redo everything to switch it to Sugarcube or something.

1 Like

I’ve experienced problems with different methods of saving variables in Harlowe.

I don’t know why it chooses to not remember variables in certain scenarios, but I was able to make a work-around. I’m assuming you are creating your variables with a $ and not a _.

Let’s assume your variable is called $name. So what I did was, I used a variable called $nameTemp, then when the player confirmed the variable, it went to an intermediate passage that set the real variable $name with the value of the $nameTemp and then redirected to the real passage that I wanted to show the player.

I hope that makes sense. Then upon loading/refreshing, who cares what $nameTemp equals. Your $name variable will be remembered properly.

The code looked something like this for the intermediate passage:

(set: $name to $nameTemp)
(redirect: "The Real Passage Name")

I too was using cycling links, text inputs, etc. and certain scenarios broke Harlowe’s ability to remember the variables. The variables would work fine throughout the game, but upon loading the story (even refreshing the browser) just certain variables would reset back to default values or the previous values they once were. It was annoying, but it only happened with my character creation screens and I never experienced it in other parts of the game.

Let me know if this helped.

1 Like

Yes, thank you so much!

This had been driving me crazy for so long.

1 Like