Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: eri0o on Sat 08/07/2017 15:52:57

Title: Get the most recent save slot [Solved]
Post by: eri0o on Sat 08/07/2017 15:52:57
Hello,

I am making my game title screen. I want the first option to be a Continue. Clicking in Continue should load the most recent save slot.

Is it possible to find out which saveslot has the most recent game state?

Thanks.
Title: Re: Get the most recent save slot
Post by: Khris on Sat 08/07/2017 16:26:07
One way I can think of is keeping a small file, and whenever the game is saved, store the number of the last used slot in that file.
When the game starts, read the file to get the slot.

You could also hide it in the slot's description; whenever the game is saved, a variable is incremented. Its value is appended to the description (and removed before it is displayed to the user).
At the start of the game you'd read all the descriptions using GetSaveSlotDescription and the one with the highest number is the most recent one.
Title: Re: Get the most recent save slot
Post by: Gurok on Sat 08/07/2017 18:07:07
The documentation says that FillSaveGameList sorts the list with the most recent save at the top. Populate the list and load the game at index 0.
Title: Re: Get the most recent save slot
Post by: eri0o on Wed 12/07/2017 00:20:31
Thanks Khris! I will use this idea for other things.

Gurok, thanks, I used your solution right now and it works flawless. I am using the same list I have for my load screen and even if it's not visible, it works. :D