RMRK is retiring.
Server is paid up for the rest of 2026, but the forum may go after that. See here for more information. Please archive or save anything you would like to keep before 2027.
Main Menu
  • Welcome to The RPG Maker Resource Kit.

[GM] Using the file functions...

Started by J-Crew, August 29, 2007, 04:54:40 PM

0 Members and 1 Guest are viewing this topic.

J-Crew

ok I'm stumped...I'm trying to use the function "file_exists()" to check if a save file with the name of game_1 exists at the beginning of the game to know if my game is able to load it, and if not do something else. But when I use it I put in:

if file_exists(game_1) = true
{game_load(game_1)}
else
{other stuff...}

and it gives me an error stating that the variable game_1 is unknown. And I know for a fact that the file exists and it's checking a variable that should  be checked as a file name. And the gamemaker help file doesn't really explain the function well enough for me to know how to use it. Could someone help please?

iceflame1019

well, I can't help with the file_ stuff but for the variable: are you sure that you initialized it at the beginning of a game in an object's Create event?  Or is there something that you know definitely initializes the variable?  I'd suggest tacking on the "global." prefix if everything's set up...

Want a personal sig like this? Ask Firerain:
http://rmrk.net/index.php/topic,20203.0.html

Arrow

He's using a built in variable, no need to initialize it.

I can't help, because I always made the game just load the file without checking. Never had a problem before, so I assume that if the file doesn't exist it just doesn't like, load.

J-Crew

#3
I don't think it's supposed to be a variable...it just is reading it that way. But I'll try to just load it without checking first. thanks.

Edit: Ok I tried to just load it, but when I do that, if there is no file to load, it doesn't initiate the actions that It's supposed to. Such as transfer to a new room, and set some global variables.