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

GameMaker Saving and Loading JSON

N

NNNIKKI

Guest
Whenever I startup my game, I get this error:
Data structure with index does not exist.
at gml_Script_load_game (line 21) - for (var a = 0; a < 36; a += 1;) global.lc[a] = levelslist[? a];

That's funny, because in my save game code I have this:
var levelslist = ds_list_create();
for (var a = 0; a < 36; a += 1;) ds_list_add(levelslist,global.lc[a]);
ds_map_add_list(mainmap,"Levels",levelslist);

And I know for a fact that it saves properly.
WHat's the problem? I'm not really experienced with JSON yet.
 

Paskaler

Member
What I can spot is that levelslistis a ds_list and you are using the accessor meant for ds_maps in the error message:
levelslist[? a] should be levelslist[| a]
 
N

NNNIKKI

Guest
oh, i didn't know that
i copied it from a vid where he used ds_maps
Thanks for the help!
 
Top