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

CatFish21sm

Villager
Member
Joined
Oct 10, 2017
Messages
16
Reaction score
2
First Language
English
Primarily Uses
RMMV
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!
 

Aerosys

Veteran
Veteran
Joined
Apr 23, 2019
Messages
323
Reaction score
308
First Language
german
Primarily Uses
RMMZ
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.
 
  • Like
Reactions: Bex

Bex

Veteran
Veteran
Joined
Aug 2, 2013
Messages
1,492
Reaction score
408
First Language
German
Primarily Uses
RMMV
@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.
 

CatFish21sm

Villager
Member
Joined
Oct 10, 2017
Messages
16
Reaction score
2
First Language
English
Primarily Uses
RMMV
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.
 
Last edited:

Hyouryuu-Na

Procrastinator
Veteran
Joined
Jun 15, 2017
Messages
771
Reaction score
1,732
First Language
Not English
Primarily Uses
RMMV
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?
 
Last edited:

Aerosys

Veteran
Veteran
Joined
Apr 23, 2019
Messages
323
Reaction score
308
First Language
german
Primarily Uses
RMMZ
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.
 

Attachments

CatFish21sm

Villager
Member
Joined
Oct 10, 2017
Messages
16
Reaction score
2
First Language
English
Primarily Uses
RMMV
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!
 

CatFish21sm

Villager
Member
Joined
Oct 10, 2017
Messages
16
Reaction score
2
First Language
English
Primarily Uses
RMMV
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!
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

Oh man the controls in Mario Sunshine are pretty awful and I haven't even witnessed the controls without FLUDD
Lots of cool changes for Battle Castle in the works! Not just reworked dialogue, but gameplay, combat, and possibly lore changes to make things weightier.
Actor2_2 added!

I started really going in on my project April of last year... I'm just now making starting the actual game... making assets (and not even all of them), whoooo... TIME SINK.


Imagine being a pleb and using --------------------.js :LZSwink:

Forum statistics

Threads
102,946
Messages
996,204
Members
134,410
Latest member
Kylion_Shadowwolf
Top