Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Volcan on Sat 10/11/2012 03:36:47

Title: Gui not turn off [solved]
Post by: Volcan on Sat 10/11/2012 03:36:47
I maybe made a mistake somehow.

gGui1 is not turn off after another gui appears after pressing a button.

Quote
  gGui1.Visible = false;
  gRestoreGame.Visible = true;
  lstRestoreGamesList.FillSaveGameList();
  mouse.UseModeGraphic(eModePointer);
  gIconbar.Visible = false;
  gGui1.Visible = true;
Title: Re: Gui not turn off
Post by: Icey on Sat 10/11/2012 05:04:52
gGui1.Visible = true;

Remove that
Title: Re: Gui not turn off
Post by: geork on Sat 10/11/2012 05:06:06
Here's the offending line:
Code (AGS) Select
gGui1.Visible = false;
gRestoreGame.Visible = true;
lstRestoreGamesList.FillSaveGameList();
mouse.UseModeGraphic(eModePointer);
gIconbar.Visible = false;
gGui1.Visible = true; //HERE!!!!!!!

This should solve it. :) Using a find and replace for terms which MAY contradict a command which isn't working is often a good way to spot these

EDIT: Beaten by Icy :P
Title: Re: Gui not turn off
Post by: Icey on Sat 10/11/2012 05:12:27
I got to it first but you gave more advice.

+10xp to the both off us ;)
Title: Re: Gui not turn off
Post by: Volcan on Sat 10/11/2012 14:10:24
Thank you guys.

Now I have another problem:

gGui1 has New game, Restore and Quit buttons.
By removing gGui1.Visible = true;, gGui1 won't show up if Restore gui is closed whitout restoring.
Title: Re: Gui not turn off
Post by: Volcan on Sat 10/11/2012 14:42:00
I solved my problem using variables

Quotefunction btnCancelRestore_OnClick(GUIControl *control, MouseButton button)
{
  close_restore_game_dialog();
  if (Begining == 0)
  {
   gGui1.Visible = true;
  }
}

Don't forget to set Begining to 1 when clicking on New Game.