(Solved) Need help with a saving/loading system


I dont know if i should just find some online tutorial, follow that and patch work my game into it but i thought i might as well ask here. My game is a music oriented clicker game (didnt just want to say clicker game or i think id be shot on the spot) but there is money, upgrades, backgrounds and music to keep track of. Ive also only ever made smaller games so they dont really need a saving system so i have no clue what i would need to do. I looked up a few vids and saw a lot of alien code so anyone have any advice for me?


If you can keep all the variables you need to save stored inside an array or list, you can use a for loop to save that data into a .ini file and the same to load it back up.

The alternative is saving them 1 by 1.

https://docs.yoyogames.com/source/dadiospice/002_reference/file handling/ini files/ini_write_real.html

I copied the code from the manual and adapted it:

ini_open( 'savedata.ini' );

for (var i = 0; i < array_length_1d(a_variables to save); i ++){
   variable_to_save = a_variables_to_save[i];
   ini_write_real( 'save1', string(i), variable_to_save);

That would save any info stored in the array and you'd do something similar but with ini_real_real for loading

There is 1 easier way to save (game_save / game_load) and many more "difficult" ways to save, depending upon your understanding but I think .ini is the easiest to get into.