Developing an Auto-Save feature.

Hello, I am curious to learn some scripting behind this feature. I am aware Hudell has an autosave script that I'm going to use, but I would like to know if there was a solution to my exploration before finding Hudell's script.

I learnt that the following code (3 being the save ID) saves the current gameplay to that save slot.


◆Script:$gameSystem.onBeforeSave();
: :DataManager.saveGame(3);


However, I do not know how to adjust the save ID to that of the currently playing file. I came across:


DataManager::last_savefile_index

But haven't been able to use that. If I can figure out how to obtain the save ID currently being used (or last loaded), I think I would be able to do this without Hudell's script.
You're looking at two different engines there.  The script snippet you have is from MV, but DataManager::last_savefile_index is from VX Ace.  Explains why you can't use it.  It's not in MV.


I am assuming you're using MV (might be a good idea to update your profile to say that).


DataManager.saveGame(DataManager.lastAccessedSavefileId());
Thank you very much!! The problem's been solved.

Original thread: https://forums.rpgmakerweb.com/threads/developing-an-auto-save-feature.74316/