I'm trying to create a good working save script in my game, but something just seems to go wrong. When I start the game, I check whether the save file exists. If it does, I show two buttons, Continue and New Game. If it doesn't, I only show the New Game button. So far, so good. If you click New Game, the game starts from the very beginning, just like I told it to. All events in the game world work as well. But when I click Continue... a certain event (and probably even more as soon as I insert them) doesn't work any more. Also, when I run it in Debug Run and then click on Continue, I get the message: Error E1513 - Crash in Event.
These are the pieces of code which should take care of the Saving and Loading:
continue_handle = file_open_read("my_save1.SAV");
if (continue_handle) continue_pan.flags = VISIBLE;
file_close(continue_handle);
PANEL* save_pan =
{
pos_x = 0;
pos_y = 0;
layer = 1;
button(0, 0, save_bmp, save_bmp, save_bmp, save, null, null);
}
function save()
{
game_save("my_save", 1, SV_ALL);
}
function continu()
{
while(key_any) wait(1);
game_load("my_save", 1);
wait(-1);
}