[GM] Using the file functions...

0 Members and 1 Guest are viewing this topic.

**
Rep:
Level 88
I'm scared of my grandma. Wouldn't you be?
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?
« Last Edit: March 04, 2014, 01:44:16 AM by modern algebra »

****
Rep:
Level 88
wrath of winter
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

********
Rep:
Level 96
2011 Most Missed Member2010 Zero To Hero
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.

**
Rep:
Level 88
I'm scared of my grandma. Wouldn't you be?
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.
« Last Edit: September 01, 2007, 12:57:25 AM by J-Crew »