Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: on Sat 06/02/2016 18:05:03

Title: Save doesn't work
Post by: on Sat 06/02/2016 18:05:03
Hello everybody.
I have a problem with the button save of my game, i don't know why cant's save the game. In the debug mode it do well but don't put the save game's name in the list box. Sorry for my english.

  int gameSlotToSaveInto = lstSaveGamesList.ItemCount + 1;
  int i = 0;
  while (i < lstSaveGamesList.ItemCount)
  {
    if (lstSaveGamesList.Items == txtNewSaveName.Text)
    {
      gameSlotToSaveInto = lstSaveGamesList.SaveGameSlots;
    }
    i++;
  }
  SaveGameSlot(gameSlotToSaveInto, txtNewSaveName.Text);
  close_save_game_dialog();

Edit: I'm using the Default template
I have tried with a new project and it's works, but no in my project. Help please.
Title: Re: Save doesn't work
Post by: on Sat 06/02/2016 20:32:53
Solved. If someone happen the same:
Listbox.FillSaveGameList();
In the template isn't and gone back me crazy :tongue:
Title: Re: Save doesn't work
Post by: Khris on Sat 06/02/2016 20:45:43
The relevant functions from the Default template of AGS 3.3.4:
function show_restore_game_dialog()
{
  gRestoreGame.Visible = true;
  lstRestoreGamesList.FillSaveGameList();
  mouse.UseModeGraphic(eModePointer);
  gIconbar.Visible = false;
}

function show_save_game_dialog()
{
  gSaveGame.Visible = true;
  // Get the list of save games
  lstSaveGamesList.FillSaveGameList();
  if (lstSaveGamesList.ItemCount > 0)
  {
    // If there is at least one, set the default text
    // to be the first game's name
    txtNewSaveName.Text = lstSaveGamesList.Items[0];
  }
  else
  {
    // No save games yet, default empty text.
    txtNewSaveName.Text = "";
  }
  mouse.UseModeGraphic(eModePointer);
  gIconbar.Visible = false;
}