[SOLVED] Implementing an autosave feature (troubles with FillSaveGameList)

Started by DrSlash, Sat 16/05/2020 01:34:44

Previous topic - Next topic

DrSlash

Hey, everyone! Haven't been here for a while.

So, long story short, I've been trying to work out a way of implementing an autosave feature in my AGS game, and I can't get these automatically saved games to appear on the list in my custom GUI used for loading saves. I am assuming the problem is that I am saving them to slots #101-103, while the manual states that FillSaveGameList "can only hold 50 save games." I would use different slots (such as #47-49), but as I've found out, AGS changes the indices of all games saved to these slots every time you make or delete a save (for example, if you have three autosaves saved to slots #47-49 and make a manual save in slot #1, the nnumbers of your saved games will change to #1, #2, #3 and #4, rather than staying #1, #47, #48 and #49). This poses a problem, as without having a fixed slot number, there is no way to tell an autosave from a save that was manually created by the player. Adding autosaves to the list manually with ListBox.AddItem isn't really an option either, since I want the list to be sorted time (which FillSaveGameList does automatically, and I can't think of any way to do it manually).

Essentially, I need my automatic saves to:
1) always remain in the assigned save game slot
2) appear on the list along with other saved games (either automatically through FillSaveGameList or by manually adding them in some other way)
3) be sortable by the time

Does anyone know of a workaround? Thanks :smiley:

Slasher

 SaveGameSlot(100, "Game saved.");  // example

Should always appear in list..

DrSlash

Nope, just tested it, only the games saved to slots numbered below 100 appear on the list, even if I'm using the default SaveGameDialog() function. By the way, I'm using AGS 3.4.1, could it work differently in the version I'm using?

However, I've just noticed that I might have overlooked something. I'm going to give this idea a go and will update the thread if I succeed.

Crimson Wizard

You do not have to rely only on FillSaveGameList, you may also add your own items into the list. You can also make your own list and fill it as you need, using Game.GetSaveSlotDescription() to find out which slots exist.

Sorting by time may probably be done by saving a custom file with savegame timestamps into $SAVEGAMEDIR$ and then reading from there when you need to display a list.

DrSlash

Quote from: DrSlash on Sat 16/05/2020 02:17:25However, I've just noticed that I might have overlooked something. I'm going to give this idea a go and will update the thread if I succeed.
It worked! Turns out, save slots between #50 and #100 work exactly the way I need. I believe only slots with numbers below ~#50 are getting renumbered when you create/delete a save. I don't know why I haven't tried that earlier. Solved!

Thanks again for everyone's input!

SMF spam blocked by CleanTalk