Problem with GUI Visibility - Pause Game When Shown is not working

Started by skabb, Thu 05/01/2012 05:41:01

Previous topic - Next topic

skabb

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:
Code: ags

    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?

monkey0506

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.

skabb

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.

Khris

Try this:

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


Then:
Code: ags
  gElevator.Visible = true;

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

SMF spam blocked by CleanTalk