Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Mr Games on Sun 18/11/2018 19:55:32

Title: Inventory window won't close [SOLVED]
Post by: Mr Games on Sun 18/11/2018 19:55:32
Hi all,

So I'm shelving my cycle-through-item cursors-without-GUI idea, only because I don't have enough experience to script it properly.

I created a GUI for an item inventory and made a button with a cross to close it. However, it won't disappear for some reason.

My script (located in Global script)

Code (ags) Select
function CloseInv_Click(GUIControl *control, MouseButton button) {

  gGui1.Visible = false;
}


CloseInv is the name I gave to the button for closing the window.

Since it won't disappear, I'm wondering if there's a clash with the button I used to make it visible in the first place?

Code (ags) Select
function OpenInventory_AnyClick()
{
  gGui1.Visible = true;
}

Title: Re: Inventory window won't close
Post by: Snarky on Sun 18/11/2018 20:32:05
Probably a version of this problem (http://www.adventuregamestudio.co.uk/forums/index.php?topic=51617.0) from a couple of threads down.

In order for a function to be run when you click on a button (as with most other game events), it must be created or linked through the properties/events panel in the GUI editor.
Title: Re: Inventory window won't close
Post by: Mr Games on Sun 18/11/2018 20:49:56
EDIT:

Fixed. I honestly did do it via the event the first time, so I don't know why it wasn't working.
Sorry for taking your time.
Title: Re: Inventory window won't close
Post by: Snarky on Mon 19/11/2018 20:29:50
No problem, happy you got it working! (And yes, creating/linking events can be a bit fiddly, and it's fairly easy to get it wrong in some hard-to-notice way.)