Custom Save / Restore GUIs

Started by Cogliostro, Mon 19/05/2014 04:53:14

Previous topic - Next topic

Cogliostro

Okay, running AGS 3.2, and I wanted GUI's that reflected the appearance of my game rather than the default game.  So I just created an image and used it as the background for the existing GUI using the same functions -- or nearly so.  The gRestoreGame works okay, but the save, delete, and cancel buttons on gSaveGame don't work at all.  I can type in the name of a game to save and hit ENTER, but clicking on Save accomplishes nothing. 



The buttons are all using blank GIFs without any text.  With the actual graphic being part of the background image, but that doesn't seem to effect anything except this one GUI!  The default GUIs were created for a game set at 320X200, and my game is 634x400, but again that hasn't effected any of the other GUIs.  I did go back and make sure all of the buttons are named the same.  And I even compared the scripting and GUI settings between this game and one using the default GUIs - everything looks the same, it just doesn't work.

Code: ags

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);
}

function close_save_game_dialog()
{
  gSaveGame.Visible = false;
  mouse.UseModeGraphic(eModePointer);
}


function btnDeleteSave_OnClick(GUIControl *control, MouseButton button)
{
  if (lstSaveGamesList.SelectedIndex >= 0)
  {
    DeleteSaveSlot(lstSaveGamesList.SaveGameSlots[lstSaveGamesList.SelectedIndex]);
    lstSaveGamesList.FillSaveGameList();
  }
}

function btnCancelSave_OnClick(GUIControl *control, MouseButton button)
{
  close_save_game_dialog();
    if (Hand==1) BtnTriforce.Visible=true;  //This brings up a spinning icon used to access all of the menus.
}

function btnSaveGame_OnClick(GUIControl *control, MouseButton button)
{
  int gameSlotToSaveInto = lstSaveGamesList.ItemCount + 1;
  int i = 0;
  while (i < lstSaveGamesList.ItemCount)
  {
    if (lstSaveGamesList.Items[i] == txtNewSaveName.Text)
    {
      gameSlotToSaveInto = lstSaveGamesList.SaveGameSlots[i];
    }
    i++;
  }
  SaveGameSlot(gameSlotToSaveInto, txtNewSaveName.Text);
  close_save_game_dialog();
    if (Hand==1) BtnTriforce.Visible=true;
}


function txtNewSaveName_OnActivate(GUIControl *control)
{
  // Pressing return in the text box simulates clicking the Save button
  btnSaveGame_OnClick(control, eMouseLeft);
}


And since this could be important, here are the settings I used for the buttons on gSaveGame.

GUI: gSaveGame:
Button Name: btnSaveGame
Action: RunScript
OnClick: btnSaveGame_OnClick

GUI: gSaveGame:
Button Name: btnDeleteSave
Action: RunScript
OnClick: btnDeleteSave_OnClick

GUI: gSaveGame:
Button Name: btnCancelSave
Action: RunScript
OnClick: btnCancelSave_OnClick

GUI: gSaveGame:
Text Box: txtNewSaveName
OnClick: txtNewSaveName_OnActivate

**ANY** suggestions about where to look for the trouble? 

- Cogliostro

p.s.  Wow!  Am I rambling and incoherent while posting this.
"First things first, but not necessarily in that order." - Dr. Who

Khris

Could you upload a copy of the game so we can take a look?
You can also try re-creating the GUI from scratch, this fixed it for people who had similar issues, afaik.

SMF spam blocked by CleanTalk