Adventure Game Studio

AGS Support => Advanced Technical Forum => Topic started by: Sakspapir on Thu 08/02/2024 13:21:50

Title: Is it possible to know if the game is in blocking state?
Post by: Sakspapir on Thu 08/02/2024 13:21:50
Hi guys,

I'm wondering if there's a function/field that returns the current blocking state of the game?

I have some GUIs that might or might not be visible during gameplay. But every time the game enters blocking state (e.g. Wait(xx) or cChar.Walk(x,y,eBlock) or similar functions), I want these GUIs to be forced to have their .Visible field set to false.

My plan is to do something like this:

function late_repeatedly_execute_alway()
{
  if (theGameIsInBlockingState()) // <--- This is the function I'm looking for
  {
    gGui1.Visible = false;
    gGui2.Visible = false;
  }
}


Of course, if there's a function to achieve this already, that would be even better. I've tried looking through the documentation but couldn't find anything to suit my needs. But as my wife would say: "The fact that you can't find it, doesn't mean it's not there".

All help is greatly appreciated!

Title: Re: Is it possible to know if the game is in blocking state?
Post by: Crimson Wizard on Thu 08/02/2024 13:48:49
The IsInterfaceEnabled is the closest that I might think of.
https://adventuregamestudio.github.io/ags-manual/Globalfunctions_General.html#isinterfaceenabled

But there's also a way of automating this using "When player interface is disabled, GUI should..." setting in General Settings, one of the choices there is "Be hidden". Individual GUIs may be excluded from this by setting their PopupStyle to "Always shown". I think they still may have their Visible state toggled by a script command.
Title: Re: Is it possible to know if the game is in blocking state?
Post by: Sakspapir on Fri 09/02/2024 06:51:21
Thank you!

I'll look into those two options.