Checking if Save File is Present

Hello!
 
Ruby just decided to do whatever it want and that brings me question:
How can I check if save file is present?
Other than 'if DataManager.load_game(0)', because putting that in conditional actually loads the game (for some mysterious reason). I was struggling with this for hours and when I located the problem I was really surprised how stupid it can be.
 
Short description:
I have a scene and if I click something, it forces the method.

def some_update_method  if Input.trigger?🙂somebutton) if cursor_hit? # < this checks if the cursor is on clickable image  RPG::SE.new(Fire9,100,100).play  SceneManager.goto(Scene_Map) end  endendHowever, I created sprites (these clickable images), that appear when a save file is present, hence the 'if DataManager.load_game(0)' is needed:

Spoiler
class Sprite_Clickable < Sprite def initialize(viewport,id,object = 0) super(viewport) @object = object setup_image initial_position end def initial_position okay, lets skip that part end def setup_image case @object when 0 self.bitmap = Cache.game("Chapter 0") when 1 if DataManager.load_game(0) # <<< WHY IS THIS PROCESSING? self.bitmap = Cache.game("Chapter 1") else self.bitmap = Cache.game("Chapter -") end when 2 etc. etc. end ...more stuff here...end
And how in the hoof the 'DataManager.load_gane(0)' is processing when I'll close the scene? I really cannot understand this.

The result is that, when I click an image, it loads the last save for no reason.

Reference image:

Spoiler
JiKGC3Z.png
Any help appreciated.
If you just need to check if any save file exists, there's always:

DataManager.save_file_exists?If you need a specific save file, then you'll need to get a list of save file (Dir.glob(Save*.rvdata2) and check each entry in the list (it's an array, so you can just loop through it)
I need to check the specific save files.
  like there was

if DataManager.load_game(0) blah blahendif DataManager.load_game(1) blah blahendif DataManager.load_game(2) blah blahendI need to replace DataManagers with something else.
 
I'm not sure how should I use that list. =P
 
Actually I'm trying to do something, I hope it will work. Nope.
HOW is this even possible? This is 
Flower.png
! (Fantastic! =3)
 
WtvmtpT.png

Also, on a flipside - when I click an image, that loads a game, then it works properly - the code below (loads in conditional) don't process.
It only happens when I'll just close the scene by going to Map.
 
WtvmtpT.png

I even tried moving this to another method, where it would be run only once upon initializing:

def initialize_unlockables $game_variables[61] = 1 if DataManager.load_game(0) $game_variables[62] = 2 if DataManager.load_game(1) $game_variables[63] = 3 if DataManager.load_game(2) $game_variables[64] = 4 if DataManager.load_game(3) endbut the same thing happens. This is definitely the stupidest thing I ever encountered in Ruby. How is this even possible?
 
WtvmtpT.png

It is solved, thanks to Glasses (Mr. Trivel)
This did the thing:

File.exists?("Save01.rvdata2")and the mysterious powers are no longer loading the save for no reason upon leaving the scene.

I don't know what to think about that issue...

This topic can be closed. (=

Original thread: https://forums.rpgmakerweb.com/threads/checking-if-save-file-is-present.49606/