Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: on Sun 21/01/2007 08:27:52

Title: Removing popup GUI
Post by: on Sun 21/01/2007 08:27:52
Hey guys

Here's the situation. In my room there is a desk drawer, which can be opened and inside is a photo. When my character clicks on the photo, a close up of the photo is shown. To do this, I have created a GUI which pops up, and then is supposed to be clicked away when the player is finished viewing the photo.

I have figured out how to make the gui pop up when the photo in the scene is clicked on, but I cannot get the gui to disappear again, how would I go about doing this?
Title: Re: Removing popup GUI
Post by: monkey0506 on Sun 21/01/2007 08:47:18
// on_mouse_click
if (gPicture.Visible) gPicture.Visible = false;


Something along the lines of that?
Title: Re: Removing popup GUI
Post by: on Sun 21/01/2007 08:52:51
Sorry to sound stupid but where would I put the code, in the room script?
Title: Re: Removing popup GUI
Post by: Akatosh on Sun 21/01/2007 10:35:20
I'd rather say in the global script, under on_mouse_click.
Title: Re: Removing popup GUI
Post by: Ashen on Sun 21/01/2007 11:36:19
If the picture is on a 'popup modal' GUI, that line will need to go before the if (IsGamePaused() == 1) part of on_mouse_click. Popup modal GUIs pause the game, so anywhere else and it won't run - since you didn't tell us what you've already tried (and, please, DO in future), it's possible this is the problem you've had. If the GUI is only used in one room, you could probably make an on_mouse_click function in that room to handle it.
Title: Re: Removing popup GUI
Post by: on Sun 21/01/2007 14:58:32
Quote from: OnlyOneKenobi79 on Sun 21/01/2007 08:27:52
Here's the situation. In my room there is a desk drawer, which can be opened and inside is a photo. When my character clicks on the photo, a close up of the photo is shown. To do this, I have created a GUI which pops up, and then is supposed to be clicked away when the player is finished viewing the photo.

If you're willing to hear a suggestion from a newbie, why not make an object of the photo which is invisible to start with. Make it visible (in code) when you want it to 'pop up'. In the object's interact event simply hide the object again.

Ciao.
Title: Re: Removing popup GUI
Post by: Ashen on Sun 21/01/2007 17:27:05
If it's a one-off, that would probably be the sensible way to go about it. If it's being used to show close-ups of a lot of things, though, it seems a bit silly to have to reserve an Object in all/most rooms when a GUI shouldn't be that hard to get working.
Title: Re: Removing popup GUI
Post by: monkey0506 on Sun 21/01/2007 20:56:43
I'm sorry for having been so vague. In my defense I was rather tired and so I just assumed you had gotten the "turn GUI on" bit working via the script. Thanks to Akatosh and Ashen for adding more detail.