Get the most recent save slot [Solved]

Started by eri0o, Sat 08/07/2017 15:52:57

Previous topic - Next topic

eri0o

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.

Khris

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.

Gurok

#2
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.
[img]http://7d4iqnx.gif;rWRLUuw.gi

eri0o

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

SMF spam blocked by CleanTalk