How to check if a save file exists? Complete beginner.

So I'm just learning the basics of JS and I'm not sure at all how to do this. I've searched the forums but all of the answer's are over my head.
I'm trying to create a simple tutorial at the beginning of the game that explains how to save the game. It runs on a loop function and preforms an IF check to see if there is a save file. If there is a save file It breaks the loop shows some text flips a switch deletes the event and the game continues normally. Otherwise it loops the event until there is a save file present.
The player can not leave the map until they have saved the game. I've got everything working except checking to see if there is a save file. I know I will have to use the custom script option in the IF branch, but I dont know what script to use or how to check the variable. I know this is a obviously a beginner mistake but what I have now is
IF:Script: DataManager.isAnySavefileExists()==true
*Break loop
*(Other stuff)
End
*Repeat.

PS. I'm also planning to add an event that does the same thing but forcefully loads the top save file later on, if one exists. I'm going to go ahead and assume that I'm going to have issues with this, especially if the save file does not exist in slot 1 but another slot. If you would be so kind as to help me with this issue aswell I would greatly appreciate it. And thank you for your time!
The command to check if a Save File exists is this one
Code:
DataManager.isAnySavefileExists()
Paste it into the IF-Statement.

PS: I'm not sure if you really need a tutorial that is such detailed. My personal recommendation would be, place a Save Point on the Map. Once the Player interacts with it, silently turn a Switch "Savepoint visited" ON, and when the Player wants to leave that area, just check if this Switch is on or off.
@Aerosys Example is sadly missing in the Scriptcall List, which normaly is very helpful.
You also find some Commands about Loading and Saving in there.
Never-mind. I was doing the script call correctly the entire time. I organized my loop command and break loop incorrectly so the event was never even preforming the script call it was just looping the event My bad.
Thanks for your comments though! Without them I never would have played around with it and found that issue! I need to remember to check my work more often lol.
This is how you use script calls in conditions:
1597070133272.png

You could also write DataManager.isAnySavefileExists()==true but that's not really necessary. It by default checks if the condition is true.

Edit: @CatFish21sm Oh, you already did this but it didn't work. could you provide a screenshot of what you did?
Are you using the IF-Statement? I just tried it on my machine. By the way, you don't need the " == true", you can just leave it out.
This is how you use script calls in conditions:
View attachment 154742
You could also write DataManager.isAnySavefileExists()==true but that's not really necessary. It by default checks if the condition is true.

Edit: @CatFish21sm Oh, you already did this but it didn't work. could you provide a screenshot of what you did?

I got it thanks! I wasn't properly organizing my loop and break loop commands and that was causing it to loop the event and ignoring the script call. That's my bad lol I got to playing around with it a bit and fixed it. Thanks again for the comment!
Are you using the IF-Statement? I just tried it on my machine. By the way, you don't need the " == true", you can just leave it out.
I got it thanks! I wasn't properly organizing my loop and break loop commands and that was causing it to loop the event and ignoring the script call. That's my bad lol I got to playing around with it a bit and fixed it. Thanks again for the comment!
Thanks for that! I'm gonna use it in my Touhou fangame, to let the player know that they haven't save and has completed a "No Save" run!

CaraPrincess, please refrain from necro-posting in a thread. Necro-posting is posting in a thread that has not had posting activity in over 30 days. You can review our forum rules here. Thank you.

Original thread: https://forums.rpgmakerweb.com/threads/how-to-check-if-a-save-file-exists-complete-beginner.125107/