Help in restore saved game process. (SOLVED)

Started by PERXEO, Tue 09/05/2023 14:38:40

Previous topic - Next topic

PERXEO

I have created a GUI to restore save games. For this, I have created a GUI with a list box (gRestoreList) in which I load the list of saved games and a text box (gRestoreText) in which I put the name of selected item:

Code: ags
function show_restore_game_dialog()
{
  gRestoreGame.Visible=true;
  gRestoreGame.X=(Screen.Width-gRestoreGame.Width)/2;
  gRestoreGame.Y=(Screen.Height-gRestoreGame.Height)/2;
  Mouse.UseDefaultGraphic();
  // get the list of save games
  gRestoreList.FillSaveGameList();

  if (gRestoreList.ItemCount > 0)
  {
    // if there is at least one, set the default text
    // to be the first game's name
    gRestoreText.Text = gRestoreList.Items[0];
  }
  else
  {
    // no save games yet, so default to empty text
    gRestoreText.Text = "";
  }
}

In this GUI I have also a buttom called btnRestoreGame and this is his function:

Code: ags
function btnRestoreGame_OnClick(GUIControl *control, MouseButton button)
{
  
  if (Game.GetSaveSlotDescription(gRestoreList.SelectedIndex)==null)
  {
    Display("no hay nada en el slot %d ", gRestoreList.SelectedIndex);
  }
  else
  {
    String selectedText = gRestoreList.Items[gRestoreList.SelectedIndex];
    Display("TEXTO en %d, es %s ",gRestoreList.SelectedIndex,  selectedText);
    RestoreGameSlot (gRestoreList.SelectedIndex);
  }
  
}

but when I prove the game, and I try to restore a saved game I obtain this error:



I don't understand why!! Any help???

Khris

The error message is telling you exactly what the problem is: you saved when your game had 7 GUIs, and you've now added a new one. That means you can non longer restore older savegames.

To test if your game can properly load a savegame, you need to create a fresh savegame first, then restore this new savegame.

PERXEO

Oh thanks!! I didn't understand exactly the error message, because sometimes it says game:8, save 7, or game:10, save:9 or differents values.

PERXEO

QuoteTo test if your game can properly load a savegame, you need to create a fresh savegame first, then restore this new savegame.
In order to to this, where are exactly the savegames stored?

here C:\Users\USER\Saved Games\NAME_OF_THE_GAME ??

SMF spam blocked by CleanTalk