I need help instantly loading a save file index by script call for custom save menu

So, I figured out how to make my save points automatically save without opening up the save menu scene.


$gameSystem.onBeforeSave();
DataManager.saveGame(1);
StorageManager.cleanBackup(1);


However.... I did not figure this out on my own. I have a friend on chatroom who told it to me, but he seems busy and I can't have my script call needs for him every morning in his inbox two days in a row.


I was wondering if someone could help me with a script call to load that save file, index 1.


The script as well as any explanation how it works would be lovely. I enjoy learning as I go what is doing what.


For example, I don't know why the above takes place on three lines and not one. There are three things that need to be executed for the save to carry out. Any takers?


Thanks in advance.
They are separated so that they can focus on a specific thing, that way it is also easy to modify them if needed (especially for aliasing instead of overwriting).  


Anyway you can probably try this


$gameSystem.onBeforeLoad(1);
DataManager.loadGame(1);
StorageManager.cleanBackup(1);




or just plain


DataManager.loadGame(1);
@Engr
I tried both methods. The single line either freezes my game or, like the multiple line script call, this pops up.
 

Spoiler
[IMG]http://puu.sh/tzjvC/23ad38856e.jpg[/IMG]
Yeah, I had a feeling that wouldn't work or our friend would have told us that it was that simple.... Any other ideas?


Edit: The answer is somewhere in here, if posting this can assist someone in helping.

 


//-----------------------------------------------------------------------------
// Scene_Load
//
// The scene class of the load screen.

function Scene_Load() {
this.initialize.apply(this, arguments);
}

Scene_Load.prototype = Object.create(Scene_File.prototype);
Scene_Load.prototype.constructor = Scene_Load;

Scene_Load.prototype.initialize = function() {
Scene_File.prototype.initialize.call(this);
this._loadSuccess = false;
};

Scene_Load.prototype.terminate = function() {
Scene_File.prototype.terminate.call(this);
if (this._loadSuccess) {
$gameSystem.onAfterLoad();
}
};

Scene_Load.prototype.mode = function() {
return 'load';
};

Scene_Load.prototype.helpWindowText = function() {
return TextManager.loadMessage;
};

Scene_Load.prototype.firstSavefileIndex = function() {
return DataManager.latestSavefileId() - 1;
};

Scene_Load.prototype.onSavefileOk = function() {
Scene_File.prototype.onSavefileOk.call(this);
if (DataManager.loadGame(this.savefileId())) {
this.onLoadSuccess();
} else {
this.onLoadFailure();
}
};

Scene_Load.prototype.onLoadSuccess = function() {
SoundManager.playLoad();
this.fadeOutAll();
this.reloadMapIfUpdated();
SceneManager.goto(Scene_Map);
this._loadSuccess = true;
};

Scene_Load.prototype.onLoadFailure = function() {
SoundManager.playBuzzer();
this.activateListWindow();
};

Scene_Load.prototype.reloadMapIfUpdated = function() {
if ($gameSystem.versionId() !== $dataSystem.versionId) {
$gamePlayer.reserveTransfer($gameMap.mapId(), $gamePlayer.x, $gamePlayer.y);
$gamePlayer.requestMapReload();
}
};




Edit2: Here's a video of what I've found:










Edit3:


I solved it myself 😛
 

Code:
$gameSystem.onAfterLoad();
DataManager.loadGame(1);
StorageManager.cleanBackup(1);
$gamePlayer.reserveTransfer($gameMap.mapId(), $gamePlayer.x, $gamePlayer.y);
$gamePlayer.requestMapReload();
The actual loading is surely on DataManager called by Scene_File (the parent of Scene_Save and Scene_Load)

Original thread: https://forums.rpgmakerweb.com/threads/i-need-help-instantly-loading-a-save-file-index-by-script-call-for-custom-save-menu.74097/