• 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!

Having problem with continue game after rerun the program

K

krugen

Guest
I am having problem with save file. Before this, I could run the game, click new game, save game, exit game and continue game. I could still continue game if I close the program and run again provided I save my game before I close the program.

Now, I can run new game, saved and continue, but not when I close and rerun again. The continue button is there but it says my ds_grid is not set before reading it.

My new game code:

Code:
global.local_info_items = ds_grid_create(20, 3);
var i, j;
i = 0;
j = 0;
repeat (ds_grid_width(global.local_info_items))
   {
   repeat (ds_grid_height(global.local_info_items))
      {
      ds_grid_set(global.local_info_items, i, j, 0);
      j += 1;
      }
   j = 0;
   i += 1;
}


My save code

Code:
var dsw_local_info_items = ds_grid_write(global.local_info_items);
                ds_map_replace(global.game_status, "k_local_info_items", dsw_local_info_items)


My continue code:

Code:
var local_info_items_buffer = global.game_status[? "k_local_info_items"];
ds_grid_read(global.local_info_items, local_info_items_buffer);

Is there anything I'm missing?

__________________________________________
############################################################################################
FATAL ERROR in
action number 1
of Mouse Event for Left Pressed
for object obj_continue:
global variable name 'local_info_items' index (100034) not set before reading it.
at gml_Object_obj_continue_Mouse_4 (line 63) - ds_grid_read(global.local_info_items, local_info_items_buffer);
############################################################################################
--------------------------------------------------------------------------------------------
stack frame is
gml_Object_obj_continue_Mouse_4 (line 63)
 

chamaeleon

Member
I am having problem with save file. Before this, I could run the game, click new game, save game, exit game and continue game. I could still continue game if I close the program and run again provided I save my game before I close the program.

Now, I can run new game, saved and continue, but not when I close and rerun again. The continue button is there but it says my ds_grid is not set before reading it.

My new game code:

Code:
global.local_info_items = ds_grid_create(20, 3);
var i, j;
i = 0;
j = 0;
repeat (ds_grid_width(global.local_info_items))
   {
   repeat (ds_grid_height(global.local_info_items))
      {
      ds_grid_set(global.local_info_items, i, j, 0);
      j += 1;
      }
   j = 0;
   i += 1;
}


My save code

Code:
var dsw_local_info_items = ds_grid_write(global.local_info_items);
                ds_map_replace(global.game_status, "k_local_info_items", dsw_local_info_items)


My continue code:

Code:
var local_info_items_buffer = global.game_status[? "k_local_info_items"];
ds_grid_read(global.local_info_items, local_info_items_buffer);

Is there anything I'm missing?

__________________________________________
############################################################################################
FATAL ERROR in
action number 1
of Mouse Event for Left Pressed
for object obj_continue:
global variable name 'local_info_items' index (100034) not set before reading it.
at gml_Object_obj_continue_Mouse_4 (line 63) - ds_grid_read(global.local_info_items, local_info_items_buffer);
############################################################################################
--------------------------------------------------------------------------------------------
stack frame is
gml_Object_obj_continue_Mouse_4 (line 63)
If the "new game" code doesn't get run before you run the continue code, clearly your global.local_info_items variable will not be defined. If it does run before you run the continue game code, something else is messing with that variable.
 
Top