Closed hogart closed 3 years ago
Without knowing more, I have to assume that everything is working as intended. FYI, since this happens a lot, do not confuse the auto save with the active play session.
By setting Config.saves.autoload
to true
an existing auto save is automatically load upon restart. In other words, the restart is functioning properly, the auto save is simply being loaded automatically.
You should be able to see this if you manually delete the auto save, via the Saves dialog, and then restart.
As to how to address it. The easiest things you could do are to set Config.saves.autoload
to:
"prompt"
: Prompts the player to load the auto save, rather than loading it automatically.The option with a function looks promising. If I use it, how do I determine if the autoload happens programmatically?
I'm not sure I understand the question.
As noted in Config.saves.autoload
docs, by setting it to a function, whether an existing auto save loads is determined by its return value: truthy to load, falsy to not. The logic therein is your own.
I don't know how or when your language switching is running, so I can't really offer advice on how to make the two play together if that's what you're looking for.
As an off-hand idea. Have you thought about not using auto loading at all, rather instead putting a continue link/button on the starting passage/screen or wherever after the language switch is done? That should allow your switching code to work while still presenting the option to load the auto save up front to the player.
A minimal example, using macros:
<<if Save.autosave.has()>>
\<<link "Continue…">><<run Save.autosave.load()>><</link>>
\<</if>>
Well, the "switching code" is just a <a href="./index-en.html">EN</a>
:) Both language versions have the same story title and same passage names, so it works pretty much seamlessly.
Turns out I don't really need autoload after all. But the "continue" link is a nice addition anyway. Thanks for the pointers! You can close this issue.
Closing.
I'm making a game which have two language version, each in its own html file, and I wanted players to be able to switch languages on the fly without loosing progress. So I used this:
But the "Restart" button in UI bar stopped working properly: it shows the prompt and refreshes the game, but game displays the same passage.
Of course I can just manually delete the responsible keys from local and session storage, and then just
Engine.restart()
but it feels wrong.Thanks in advance for any advice!