hey so i have leaderboards in my game and i surly sucks if you get a good time close the game and then you open it again the leaderboards are blank. so i wanted to save the grid i store everything in i watched a bit around and so but i dont think i understand it.
i found this
and was like if i replace the savestruct with my global.grid_levels (the grid i save the leaderboards in) it sould work so i made 2 scripts
and
but i dont think it works because if i save something close the game and try so load it the script dose run but nothing happens would like to have some help here thx
i found this
GML:
saveStruct = {
name: "Josh",
hp: 3
};
// SAVING
var f = file_text_open_write("save.dat");
file_text_write_string(f, json_stringify(saveStruct));
file_text_close(f);
// LOADING
var f = file_text_open_read("save.dat")
saveStruct = json_parse(file_text_read_string(f));
file_text_close(f);
Code:
function lb_saving(){
// SAVING
var f = file_text_open_write("save.dat");
file_text_write_string(f, json_stringify(global.grid_levels));
file_text_close(f);
show_message("lb saved")
}
Code:
function lb_loading(){
// LOADING
var f = file_text_open_read("save.dat")
global.grid_levels = json_parse(file_text_read_string(f));
file_text_close(f);
show_message("lb loaded")
}
Last edited: