Script Call To Save And Load

I'm trying to make a mini game and save the score of the game at the end of the game with the following script call:

$gameSystem.onBeforeSave();DataManager.saveGame(1);I used Yami_SkipTitle plugin and I tried to load the game/score on a new game if I use the following script call:

DataManager.loadGame(1);SceneManager.goto(Scene_Map);I get the error message Type Error, Cannot Read Property 'pages' of undefined.

I also tried the following:

DataManager.loadGame(1);$gameSystem.onAfterLoad();SceneManager.goto(Scene_Map);But also receive the same error.

Can anyone help me with this error?
I've moved this thread to JS Plugin Support. Please be sure to post your threads in the correct forum next time. Thank you.


What other plugins do you have?


If you disable the skip title plugin, and try to load the game manually, does the same error message appear?


Can you go into developer tools (F8) and play to the error, then screenshot the console? That gives more information.


'pages' is a property of events. It seems there might be a null/undefined event - maybe you're also using an event cloning script or something?
There are save files being generated, but I can't load them if I try to load them with the normal title screen.

Untitled.png
So it's a problem with a parallel process event that's running on the map when you save.


I suppose when you save normally, it goes to a new scene, which causes parallel process events to stop running, so they're not started midway when you return.


I am not sure what the best solution to this would be, as there would be problems with stopping them even temporarily.


What is the logic behind forcing the save and then forcing the load at that point? Sounds like you're not letting the player save themselves, and not giving them an option to load a saved game - you're only allowing one save file?
I'm trying to make simple games(similar to Float,http://forums.rpgmakerweb.com/index.php?/topic/50356-float/#entry521410) of which doesn't need player to save and load.

Yes, I only use one save file.

Edit:Fixed the problem, as Shaz has mentioned that the problem was caused by a parallel process, I've rearranged the order of the events so that the game has a full second of nothing but save going on and that resolved the problem.

Thank you for the help!
awesome, and an elegant solution 🙂

Original thread: https://forums.rpgmakerweb.com/threads/script-call-to-save-and-load.52837/