Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: sven on Sun 03/09/2006 19:35:00

Title: Is there an easy way to have a custom GUI block all other GUIs? -SOLVED, kind of
Post by: sven on Sun 03/09/2006 19:35:00
My apologies if this has been asked before, but I could not find anything in the gazillion "custom quit GUI" topics I found via searching :P

I just set up a custom Quit GUI, and I noticed that while setting the GUI to popup modal stops the game, it still allows me to access other popup modal GUIs (main menu on mouse to top, inventory on mouse to bottom), and my Lucas-ish text bar ("walk to boat", "use rubber lips on yak" etc) also still gets updated while the Quit GUI is visible. The standard Quit GUI, on the other hand, blocks all other GUIs...is there a way to achieve that effect without having to manually check each time I activate a GUI which other GUIs are visible?
Title: Re: Is there an easy way to have a custom GUI block all other GUIs?
Post by: Joe on Sun 03/09/2006 21:05:23
I dont know exactly what you mean.
But I could give you a shot:

When you click on the 'Quit Game' buttom from your iconbar:


//Quit_game_buttom_click
  gStatusline.Visible=false;//to make the statusline GUI invisible
  gQuit.Visible=true;//To make your custom quit game dialog visible


But then you'll have to do the inverse when you select 'PLAY' in your custom Quit game dialog:


//Play_click
  gStatusline.Visible=true;
  gQuit.Visible=false;
//Quit_click
  QuitGame(0);


Please, tell me if I helped.
Title: Re: Is there an easy way to have a custom GUI block all other GUIs?
Post by: sven on Sun 03/09/2006 21:48:59
Thanks for giving it a shot, but that doesn' solve my problem...my explanation was probably a bit confusing.

You can see what I mean by creating a little test game with the standard GUIs and one additional GUI:

*Set up a new GUI called QUITGUI, give it two buttons. One calls a script that does Quitgame(0);, the other calls a script that does gQuitgui.visible=false;
*Set Quitgui to popup modal
*Place a button somewhere that sets gQuitgui.Visible=true;

Now, if you click the button, the simple test GUI is called; if you hit ctrl-q, the standard quit GUI is called. You will notice that with the test GUI, moving the mouse to the top of the screen will still activate the standard Statusbar GUI (that is activated by mouse ypos). The standard quit GUI will disable the Statusbar GUI (and also disable all other popup modal or mouse ypos GUIs, and stop the updating of custom statuslabel GUIs). I'm looking for a way to emulate that behavior with my custom Quit GUI that doesn't involve lots of if (gQuitgui.visible==true)&&(gSavegui.Visible==true) etc. everytime I activate another GUI element - just setting the other GUIs to invisible will not work because they will be set to visible again as soon as I move the mouse to the screen edge.

I should probably add that I'm only asking this because I'm lazy - the problem can be solved with a bit of scripting work, I'm just a bit worried that I maybe overlooked something obvious and that after I spent an hour scripting the GUIs to behave the way I want, someone tells me that there's a BlockAllGuis command or something :P
Title: Re: Is there an easy way to have a custom GUI block all other GUIs?
Post by: monkey0506 on Sun 03/09/2006 21:55:11
Hmmm...you could do something like this (so that you wouldn't have to handle it in every GUI's event handlers):

// rep_ex
if (gQuitgui.Visible) { // QUITGUI is on, so make sure other GUIs stay off
  gStatusline.Visible = false;
  gInventory.Visible = false;
  }
else { // QUITGUI is off
  // put your code to update the status line here
  }


That way you don't have to check every time you try to turn a GUI on, just if the QUITGUI GUI is already turned on, they won't be.

Also, putting your code to update the status line in the else clause means that it won't be updated unless the GUI is turned off.
Title: Re: Is there an easy way to have a custom GUI block all other GUIs?
Post by: sven on Mon 04/09/2006 19:46:28
Thanks for the tip, that's at least easier than scripting every GUI call manually :P
This is more of a feature request than anything else, but it wuld be really nice to have a GUI mode like, oh, let's call it "popup modal blocking" or "popup modal exclusive" that would make custom GUIs behave exactly like the standard quit GUI.
Title: Re: Is there an easy way to have a custom GUI block all other GUIs? -SOLVED, kin
Post by: monkey0506 on Mon 04/09/2006 22:20:19
Actually I've been working on something somewhat similar with the GUI disabling other GUIs. I think a GUI mode which would prevent other GUIs from being activated or turned on would be nice (for me specifically), but I'm not entirely sure as to how reasonable a thing it might be for implementation.
Title: Re: Is there an easy way to have a custom GUI block all other GUIs? -SOLVED, kind of
Post by: Khris on Mon 04/09/2006 23:13:08
There is another way, although it's not as nice:
QuoteMouse.SetBounds(int left, int top, int right, int bottom)

Restricts the area where the mouse can move on screen. The four parameters are the relevant pixel co-ordinates of that edge of the bounding rectangle. They are in the usual range (0,0) - (320,200).

Preventing clicks on the background can be done by turning on a completely transparent GUI behind your QuitGUI.
Hope it helps.