Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Etcher Squared Games on Sun 04/06/2006 01:39:32

Title: GUI not turning off when expected [SOLVED]
Post by: Etcher Squared Games on Sun 04/06/2006 01:39:32
I've gotten some ideas searching through the help and the forums as to what is going on, but I can't get this to work.

Here is what I'm doing.Ã,  I set a timer and when the timer goes off, which I check in repeat_execute (not the always version) then I run another function.Ã,  The first thing it does is turn off the GUI that may be showing then do other stuff.

But, the GUI is NOT turning off.Ã,  My guess from reading other threads is that it has to do with Gui.visible = false is one of those things that don't take affect until after the current script is done running...


here's my RE

#sectionstart repeatedly_executeÃ,  // DO NOT EDIT OR REMOVE THIS LINE
function repeatedly_execute() {
Ã,  // put anything you want to happen every game cycle here

Ã,  if (!time_test)
Ã,  Ã,  return;

Ã,  time_tick++;
Ã,  if (time_tick > time_max)
Ã,  Ã,  ActionPerformed(atFail, "", null, -1, null, null);
Ã,  Ã, 
}



Here's the direct function in question

function ActionPerformed(ScriptActionType action, String dialog, Region* regionWalked, int actionDone, Character* invOnChar, InventoryItem* invItem)
{
Ã,  gMyinv.Visible = false;
Ã,  bool itemPassed = (DidItemPass(action, dialog, regionWalked, actionDone, invOnChar, invItem) == 0);

Ã,  if (itemPassed)
Ã,  {
Ã,  Ã,  RunItem();
Ã,  }
Ã,  else
Ã,  {
Ã,  Ã,  Display(Script[_line].directorYell);
Ã,  Ã,  RestartGame();
Ã,  }
}


So, how do I get the GUI to hide when I want it to?

thank you
Title: Re: GUI not turning off when expected
Post by: Gilbert on Sun 04/06/2006 06:15:21
Is the GUI a popup modal? In that case the game's paused when the GUI is visible, so repeatedly_execute() won't be run.
If that's teh case, either move the code to _always, or change the GUI's mode to "always".
Title: Re: GUI not turning off when expected
Post by: SSH on Mon 05/06/2006 10:47:49
Doing a Wait(1); after the Visible command will make the screen update if Gilbot's suggestion doesn't help
Title: Re: GUI not turning off when expected [SOLVED]
Post by: Etcher Squared Games on Wed 07/06/2006 00:19:16
The wait(1) is all I needed.

Sorry about the delayed reply.  I knew the function was getting called because I put a display before and after.....

thank you