S
samueljbfrye
Guest
Hey everyone, this feels like a ridiculously small thing to be posting about, but I keep staring at the pages for DS map functions and I really don't understand what I'm missing! I'm (reasonably) familiar with GML but have never done anything that's used DS maps or save files before.
To get to grips with how they work I just made a project with a single room, a single object and the following events:
Create:
Draw:
Spacebar press:
Enter press:
The idea being that I could load the room, advance the counter, save with enter and close and open the game to check if the save and load had worked. It IS creating a save.dat file in the localappdata project folder, but, when I restart the counter is just zero. Any help would be very much appreciated. I'm sure I'm just overlooking/misunderstanding something simple...
Thanks in advance for any help!
Sam.
To get to grips with how they work I just made a project with a single room, a single object and the following events:
Create:
Code:
if file_exists("save.dat")
{
save = ds_map_secure_load("save.dat")
counter = ds_map_read(save,"counter");
}
else
{
counter = 0;
save = ds_map_create();
}
Code:
draw_text(room_width/2,room_height/2,counter);
Code:
counter += 1;
Code:
ds_map_replace(save,"counter",counter);
ds_map_secure_save(save,"save.dat");
Thanks in advance for any help!
Sam.