Max save games - 50?

Started by Ali, Sun 06/05/2012 18:18:17

Previous topic - Next topic

Ali

I'm updating an old save/load script, and I wanted to know if the 50 save games limit was still around. I searched but I couldn't find an up-to-date answer.

- Ali

monkey0506

You must be referring to this:

QuoteFillSaveGameList
(Formerly known as ListBoxSaveGameList, which is now obsolete)

ListBox.FillSaveGameList()

...

NOTE: The save game list can only hold 50 save games. If ListBox.ItemCount returns 50 and you are doing a Save dialog box, you may want to make the user replace an existing file rather than saving a new one.

The save/restore/delete functions though I can confirm all work at least up to save slots of 998 (999 is used for ResetGame). A ListBox can only hold up to 200 items. How many save slots are you looking at?

You could do something like this:

Code: ags
void FillSaveSlotCount(this ListBox*, char count)
{
  if (count > 200) count = 200;
  this.Clear();
  int i = 0;
  while (i < count)
  {
    String item = String.Format("%d.", i);
    String desc = Game.GetSaveSlotDescription(i);
    if (!String.IsNullOrEmpty(desc)) item = item.Append(desc);
    this.AddItem(item);
    i++;
  }
}


Usage:

Code: ags
lstSaves.FillSaveSlotCount(99); // fills lstSaves with 99 save slot descriptions

Ali

Yes, that's the bit which had me worried.

I'll try out that script. Thanks for the guidance!

SMF spam blocked by CleanTalk