So, my understanding was that the only difference between UI.restart() and Engine.restart() was that UI.restart() calls a dialog box (and then runs Engine.restart). However, in my game, while UI.restart() works perfectly, Engine.restart() seems to… not be running StoryInit, I think? If a variable is set to “true” over the course of the game it seems to remain true after running Engine.restart(), even though StoryInit should set it to false.
Additionally, I have a bunch of randomized text in the game that’s stored in arrays, but after using Engine.restart(), all the places the text is supposed to be just has “Error: cannot read property of undefined” messages (everybody’s favorite vague and unhelpful JS error!). So the arrays aren’t being set up properly somehow (and are not even retaining their values from the previous playthrough like other variables do).
It’s a short game that’s meant for multiple quick playthroughs and has no UI bar, so all the people who tested it for me were kind of thrown off by the “unsaved progress will be lost” dialog box, and I would really love to be able to reset the game “silently,” so I was wondering – does anyone have any insight into what’s going on with Engine.restart() and how to fix it, or have a workaround for it?