Removing popup GUI

Started by , Sun 21/01/2007 08:27:52

Previous topic - Next topic

OnlyOneKenobi79

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?

monkey0506

Code: ags
// on_mouse_click
if (gPicture.Visible) gPicture.Visible = false;


Something along the lines of that?

OnlyOneKenobi79

Sorry to sound stupid but where would I put the code, in the room script?

Akatosh

I'd rather say in the global script, under on_mouse_click.

Ashen

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.
I know what you're thinking ... Don't think that.

Fornax

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.

Ashen

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.
I know what you're thinking ... Don't think that.

monkey0506

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.

SMF spam blocked by CleanTalk