The RPG Maker Resource Kit

Other Game Creation => Other Game Making Programs => Topic started by: J-Crew on August 29, 2007, 04:54:40 PM

Title: [GM] Using the file functions...
Post by: J-Crew on August 29, 2007, 04:54:40 PM
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?
Title: Re: Using the file functions...
Post by: iceflame1019 on August 29, 2007, 05:02:07 PM
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...
Title: Re: Using the file functions...
Post by: Arrow on August 29, 2007, 08:23:58 PM
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.
Title: Re: Using the file functions...
Post by: J-Crew on August 29, 2007, 10:30:52 PM
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.