You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Forgive me for combining 3 issues into one, but since they are all related to the saving I'm too lazy to create three separate issues.
This example story can be used to demonstrate all 3 issues.
Error during restoreSave().
If you make a save, then go back and forth between Start and 'Page 2', then press load, you will get an Uncaught TypeError . This presumably happens because History.position isn't saved and restored, so it is out of bounds when History.history is restored.
createSave() ignores updated state.
If you go to 'Page 2' someVar will be updated. This results in a discrepancy between the state in store and latest entry in History.history. If the story is saved and then restored you will lose the latest updates to the store.
I don't know if this is by design, but it can lead to some frustrating bugs down the line, if people aren't aware of it. An optional argument to instruct createSave() to save the actual current state instead of the state when the passage is entered would be useful.
restoreSave() doesn't take you to the saved passage.
Another gotcha that might confuse people. When you restoreSave() it doesn't actually take you to the passage where you saved.
Again this might be by design, but it can confuse people that the state is restored, but nothing is visibly changed since and you are still looking at the same passage. I would say an option to goto the last passage in the restored history is the right move, so we can decide it for ourselves.
getAllSaveNames().
One last suggestion. I implemented it myself, but I could imagine other would find it useful if there was a method for getting all the save names in case you want the player to have multiple saves and not having to remember the save names themself.
The text was updated successfully, but these errors were encountered:
Forgive me for combining 3 issues into one, but since they are all related to the saving I'm too lazy to create three separate issues.
This example story can be used to demonstrate all 3 issues.
restoreSave()
.If you make a save, then go back and forth between Start and 'Page 2', then press load, you will get an
Uncaught TypeError
. This presumably happens becauseHistory.position
isn't saved and restored, so it is out of bounds whenHistory.history
is restored.If you go to 'Page 2'
someVar
will be updated. This results in a discrepancy between the state instore
and latest entry inHistory.history
. If the story is saved and then restored you will lose the latest updates to the store.I don't know if this is by design, but it can lead to some frustrating bugs down the line, if people aren't aware of it. An optional argument to instruct
createSave()
to save the actual current state instead of the state when the passage is entered would be useful.restoreSave()
doesn't take you to the saved passage.Another gotcha that might confuse people. When you
restoreSave()
it doesn't actually take you to the passage where you saved.Again this might be by design, but it can confuse people that the state is restored, but nothing is visibly changed since and you are still looking at the same passage. I would say an option to
goto
the last passage in the restored history is the right move, so we can decide it for ourselves.getAllSaveNames()
.One last suggestion. I implemented it myself, but I could imagine other would find it useful if there was a method for getting all the save names in case you want the player to have multiple saves and not having to remember the save names themself.
The text was updated successfully, but these errors were encountered: