Force Save without menu

I'm wondering if there's a script that will force a save to a particular save slot without the save menu showing up.
I'm wondering if there's a script that will force a save to a particular save slot without the save menu showing up.
it's just one line of code:

DataManager.save_game(1)where 1 is index of the save slot 
Oh. I see. Thanks. I wouldn't have been able to know that by myself, since I don't dabble with the scripts directly if I don't have to.

Is there a way to have it return a value if it succeeds? Or is that too much to ask?
Oh. I see. Thanks. I wouldn't have been able to know that by myself, since I don't dabble with the scripts directly if I don't have to.

Is there a way to have it return a value if it succeeds? Or is that too much to ask?
It returns true or false by default.

It will also delete any previous save if the operation fails.
...Okay. Let me approach this a different way. Say I had a use-able event that would do this, and then throw a textbox on whether it worked or not. How would I hook up the return to an if event, then?
...Okay. Let me approach this a different way. Say I had a use-able event that would do this, and then throw a textbox on whether it worked or not. How would I hook up the return to an if event, then?
Just put that one line of script in a conditional branch and it should work as intended.

Check the attached image to see the event.

savegame.png
Ohhh. I see now. Thanks. That'll be it.
The only delema whould be your current save slot vs game you are playing.

DataManager.save_game(1) works good if you are only allowing one save spot. Otherwise you will need a way to keep track of which save slot to save over. So in other words its not just a one liner. You will need a script that allows you to have global variables to keep track of how many new profiles you have and the one for each profile to hold its own value.
Naturally. I had only intended for one save slot anyways.
The only delema whould be your current save slot vs game you are playing.

DataManager.save_game(1) works good if you are only allowing one save spot. Otherwise you will need a way to keep track of which save slot to save over. So in other words its not just a one liner. You will need a script that allows you to have global variables to keep track of how many new profiles you have and the one for each profile to hold its own value.
Sorry to necropost (if 6 years later qualifies), but I happen to know a way to keep track of which save slot was the last one that any one specific game used (In short, it tells which game slot the player is using for this game), which could be helpful for anyone who comes across this.
Ruby:
$game_variables[1] = DataManager.last_savefile_index
This sets the first game variable to the last save slot this game used. (If they saved on File 1, the variable is equal to 0, if File 2, it sets to 1, etc)

Using these two ideas together,
Ruby:
$game_variables[1] = DataManager.last_savefile_index
DataManager.save_game($game_variables[1])
Should save onto the last save slot used. This should work as well:
Ruby:
DataManager.save_game(DataManager.last_savefile_index)

Original thread: https://forums.rpgmakerweb.com/threads/force-save-without-menu.35124/