Adventure Game Studio

AGS Support => Advanced Technical Forum => Topic started by: Rui 'Trovatore' Pires on Fri 04/08/2006 20:40:04

Title: Problem with Game.SetSaveGameDirectory (SOLVED)
Post by: Rui 'Trovatore' Pires on Fri 04/08/2006 20:40:04
This new Game.SetSaveGameDirectory function has allowed me to use the standard ListBox.FillSaveGameList (or something) function to simplify the whole game-saving code stuff AND to add a new "quicksave" slot. Previously, I had that slot in the same "list" as the other save files (I had no choice, ListBox.FillSaveGameList put every saved game he found on the list) and protecting it against rewriting. But now I found I could have a "Saves" file, and I wanted to do this when quicksaving:

Change directory to "/" (root directory)
SaveGameSlot(10, "**QUICKSAVE**");
Change directory to "Saves" (standard saves)

I quite liked this solution. But it doesn't work - because SaveGameSlot, like NewRoom, is called only at the end of the script being run, what I actually get is:

Change directory to "/" (root directory)
Change directory to "Saves" (standard saves)
SaveGameSlot(10, "**QUICKSAVE**");

...not a lot of good for someone who wanted to keep things separate. Plus, while it actually DID keep "**QUICKSAVE**" off my regular save/load interface, it also started messing things up when I deleted games and recalled the save/load interface - just random randomness, nothing much (games I had deleted still being there and so on).

...well, any help? Is there any way around this? I also wanted to use this feature to make a sort of "backup" save, also separate from the regular saves the player can access...
Title: Re: Problem with Game.SetSaveGameDirectory
Post by: monkey0506 on Fri 04/08/2006 20:59:45
You could make a custom function that would do:

Change directory to "/" (root directory)
SaveGameSlot(10, "**QUICKSAVE**");

void QuickSaveGame(int slot) {
  Game.SetSaveGameDirectory("/");
  SaveGameSlot(slot, "**QUICKSAVE**");
  }


And then do:

QuickSaveGame(10);
Change directory to "Saves" (standard saves)

QuickSaveGame(10);
Game.SetSaveGameDirectory("Saves");
Title: Re: Problem with Game.SetSaveGameDirectory
Post by: Pumaman on Fri 04/08/2006 21:35:58
Well, probably the only way round it is to have some sort of flag and then check it in rep_exec_always to do the SetDirectory back again. Very hacky I know, but unavoidable at the moment unfortunately.
Title: Re: Problem with Game.SetSaveGameDirectory (SOLVED)
Post by: Rui 'Trovatore' Pires on Sat 05/08/2006 15:06:05
Thanks, CJ, that worked. Hacky, like you said, but it works, and that's the important thing.