• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!
  • Hello [name]! Thanks for joining the GMC. Before making any posts in the Tech Support forum, can we suggest you read the forum rules? These are simple guidelines that we ask you to follow so that you can get the best help possible for your issue.

Question - Code The latest update broke my save/load system

R

RATInteractive

Guest
Fixed, delete
 
Last edited by a moderator:

gnysek

Member
Can you show error message too? It's hard to guess, while error message should show exact line and position of error.
 

FrostyCat

Redemption Seeker
This one is obvious, none of your variables get an initial value if your gamesave.sav file doesn't exist.

You should always be wary when instance and global variables are defined inside control structures, especially if blocks.
 
R

RATInteractive

Guest
Can you show error message too? It's hard to guess, while error message should show exact line and position of error.
yeah it just stops as it hits the first global variable, which in this case is global.music


___________________________________________
############################################################################################
FATAL ERROR in
action number 1
of PreCreate Event
for object oPop_Anim:

global variable name 'music' index (100004) not set before reading it.
at gml_Room_Room_Init_Create (line 11) - if global.music = 0
############################################################################################


whats odd is that object isn't even in the game yet
 
This:
Code:
if (file_exists("gamesave.sav"))
I see this a lot with people using ini file these days. I don't understand why they use it.

If the ini file is not there, then the defaults will be used. If the file does not exist - the game will skip all the code in the brackets.

But with that line of code, it will just skip the whole block, negating the purpose of the default values and crashing your game. That is not how you use ini files in my opinion.

Get rid of that line, its not necessary.
 

chamaeleon

Member
Room create code comes after instance create code in execution order according to the documentation for events. So if you try to read the global variable in the create code for an object it will fail if the variable is set in the room create code.
 
M

mazimadu

Guest
Whoops, wrong thread.
 
Last edited by a moderator:
Top