Problem with Game.SetSaveGameDirectory (SOLVED)

Started by Rui 'Trovatore' Pires, Fri 04/08/2006 20:40:04

Previous topic - Next topic

Rui 'Trovatore' Pires

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...
Reach for the moon. Even if you miss, you'll land among the stars.

Kneel. Now.

Never throw chicken at a Leprechaun.

monkey0506

#1
You could make a custom function that would do:

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

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


And then do:

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

Code: ags
QuickSaveGame(10);
Game.SetSaveGameDirectory("Saves");

Pumaman

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.

Rui 'Trovatore' Pires

Thanks, CJ, that worked. Hacky, like you said, but it works, and that's the important thing.
Reach for the moon. Even if you miss, you'll land among the stars.

Kneel. Now.

Never throw chicken at a Leprechaun.

SMF spam blocked by CleanTalk