D
detour
Guest
Hi,
I'm new to GM Studio (running 1.4), and have followed a few tutorials successfully, making a couple simple games. I'm trying to figure out where the best place is to initialize a global variable such that you won't run into the "global variable .... not set before reading it" error.
My current problem is I have a global variable that I need to initialize at the very beginning of the game. This variable then get's modified by events that occur in the game. I can't seem to find a place to put it that doesn't produce the error described above. I tried putting it in the room creation code, creating a new object and putting it in that objects Create event, moving that object to the top of Instance Order in the room, making sure none of the accesses of that global variable occur in any other object's Create events, etc. They all produce the error.
Any ideas on where I should declare my global?
Am I wrong to think that the Create events are executed sequentially in the room Instance Order list (from top to bottom in the list)?
Thanks for your help,
I'm new to GM Studio (running 1.4), and have followed a few tutorials successfully, making a couple simple games. I'm trying to figure out where the best place is to initialize a global variable such that you won't run into the "global variable .... not set before reading it" error.
My current problem is I have a global variable that I need to initialize at the very beginning of the game. This variable then get's modified by events that occur in the game. I can't seem to find a place to put it that doesn't produce the error described above. I tried putting it in the room creation code, creating a new object and putting it in that objects Create event, moving that object to the top of Instance Order in the room, making sure none of the accesses of that global variable occur in any other object's Create events, etc. They all produce the error.
Any ideas on where I should declare my global?
Am I wrong to think that the Create events are executed sequentially in the room Instance Order list (from top to bottom in the list)?
Thanks for your help,