Hey FieryLion,
Hope all is well and thank you for the in-depth code. Apologies for the late response as I haven't gotten a chance to work on this till now. Your code was helpful, but I'm actually saving my game in a bit of different way. I write all the information into a data structure first, then push to array. Then using "json_stringify" I turn the array into a json string and save to a temporary buffer that includes my save file.
Here's my code after I've determined which values I want to save:
// STEP 3 - JSON STRINGIFY data (convert from array to string) var json_string = json_stringify(save_data); // STEP 4 - BUFFER: create, write, save, delete // (size is string length+1, buffer_fixed means size of buffer doesn't change, alignemnt is 1) var temp_buffer = buffer_create(string_byte_length(json_string)+1, buffer_fixed, 1); buffer_write(temp_buffer, buffer_string, json_string); // write our json_string to the buffer in string format buffer_save(temp_buffer, working_directory + "Saves/" + global.save_file); buffer_delete(temp_buffer); temp_buffer = -1; // reset to -1 show_debug_message("Game saved! " + json_string);
When loading files, it's the same process but backwards. Read from the buffer, then "json_parse", then pop values off the array and back into the objects. After working on this tonight, I feel like I've tried everything. With and without "working directory" and also using a save folder like:
if (file_exists(working_directory + "Saves/" + global.save_file)) { ... }
Also, here's the name of my save file currently:
global.save_file = "dive-bitsloth-fIt0QNLgfAlboxByK9zdWOKRXRvzbMWeafIm4Q6LLlV9vykE5T.save";
I've tested this locally and other than some visual glitches, the saving works functionally. The screen that's coming up can only possibly appear if a save file exists, which I don't see how is possible if it's my first time running the game and have never saved before on itch's server. At this point I'm thinking there's something wrong with itch's CDN as my game saves perfectly on my local server and the 3rd set of characters is a randomly generated 50-character string. Not sure what else to do at this point.
Thanks for all the help so far,
bitsloth