Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: on Thu 02/03/2006 23:44:34

Title: Close Inventory by clicking outside window
Post by: on Thu 02/03/2006 23:44:34
How would I specifically for version 2.7 close the inventory by clicking outside of the inventory window? Without going into window coordinates and without using repeatedly_exexute?

I tried using the interface_click method but i couldn't get it to work.

if (interface == 2) {
??
}

2 is number for inventory.
Title: Re: Close Inventory by clicking outside window
Post by: Ashen on Fri 03/03/2006 00:18:10
interface_click only runs when you actually click on the interface, so that wouldn't work. (Never mind the fact that it's obsolete in 2.7...)

Try adding this to your on_mouse_click:

if (gui[2].Visible == true && GUI.GetAtScreenXY(mouse.x,  mouse.y) != gui[2]) gui[2].Visible = false;


That'll turn the GUI off with any click not on it, but you can fairly easily adapt it to just be Left.

Title: Re: Close Inventory by clicking outside window
Post by: on Fri 03/03/2006 20:04:31
Thanks Ashen, that helps, very sensible :)