Adventure Game Studio

AGS Support => Advanced Technical Forum => Topic started by: skabb on Thu 05/01/2012 05:41:01

Title: Problem with GUI Visibility - Pause Game When Shown is not working
Post by: skabb on Thu 05/01/2012 05:41:01
I have a GUI that I want to pause the game when it comes up until you press a button.

The GUI visibility is set to "Pause Game When Shown".

My code is:

    gElevator.Visible = true;
   
    Display("Should not see this");


When I run it, the GUI pops up and then it displays the message and continues parsing code.

Any ideas on what could be causing the GUI to not pause?
Title: Re: Problem with GUI Visibility - Pause Game When Shown is not working
Post by: monkey0506 on Thu 05/01/2012 15:58:11
That's not what pausing the game means. Pausing the game means that your interaction events, like cEgo_Talk, aren't going to be automatically called. Some other functions, such as Character.Animate may be blocked from executing, but I'm not certain of that. I am reasonably certain that any background (non-blocking) animations are paused.

repeatedly_execute and repeatedly_execute_always are definitely still called, as is on_key_press, and GUI event handlers.

I could make a more exhaustive list, but I'm just arriving at work so it will have to wait.

Don't confuse pausing the game with the engine's blocking thread. They're totally different.
Title: Re: Problem with GUI Visibility - Pause Game When Shown is not working
Post by: skabb on Fri 06/01/2012 05:02:19
Ohhh. I pulled my hair out for nothing.

I guess I'll have to find some other way to do it.

Thanks for your help.
Title: Re: Problem with GUI Visibility - Pause Game When Shown is not working
Post by: Khris on Fri 06/01/2012 06:05:53
Try this:

// top of GlobalScript.asc
void noloopcheck HaltGame(int k) {
  while (!IsKeyPressed(k)) {
    Wait(1);
  }
}


Then:
  gElevator.Visible = true;

  HaltGame(eKeySpace);
   
  Display("Should not see this until after space was pressed");