Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Tamanegi on Tue 01/02/2011 04:31:45

Title: [SOLVED] What blocks GUI buttons?
Post by: Tamanegi on Tue 01/02/2011 04:31:45
Okay, this may be a strange question, but what could be blocking a GUI button from being clicked? Because I have a button, and it worked, and then I added a lot of code somewhere else, and suddenly it stopped working; the script is never called, a message I put there is not displayed.

So far I checked:
- button image: is there
- GUIs in front of the button: added none since then
- game paused: never happens in the game
- button.clickable

There is literally over a dozen other buttons in the same GUI that all call the same function, and they all don't work anymore. I can still call the function through the script and it works perfectly.
When I put text on the buttons, it doesn't "click-move" like it should.
Title: Re: What blocks GUI buttons?
Post by: Icey on Tue 01/02/2011 05:13:54
button.Clickable = true;

I think this works.
Title: Re: What blocks GUI buttons?
Post by: Tamanegi on Tue 01/02/2011 05:18:51
I think it doesn't (tried it nonetheless), especially since I didn't change the clickable attribute.

More suggestions?
Title: Re: What blocks GUI buttons?
Post by: Icey on Tue 01/02/2011 05:32:34
Is the gui itself clickable?
Title: Re: What blocks GUI buttons?
Post by: Tamanegi on Tue 01/02/2011 06:18:23
Okay, the problem is solved and quite bizarre.

I set the button's NormalGraphic to 0 to make it invisible, then later animated the button with a view/loop. While the animation was playing, the button STILL had the size of graphic 0, which was the default 1x1 pixel clear sprite, so  the button was in fact 1x1 pixel large although it appeared larger through its animation.

I changed the sprite 0 to a button-sized clear sprite, and it works now.
Title: Re: [SOLVED] What blocks GUI buttons?
Post by: Khris on Tue 01/02/2011 08:40:01
A better way is to set the button's .Visible to false. That way you won't have to change the size or image at all.
Title: Re: [SOLVED] What blocks GUI buttons?
Post by: Tamanegi on Tue 01/02/2011 17:12:04
Yes, but because I change the NormalGraphic of the button each time it is displayed, that saves me a command line each time I do it.

Or to be honest, at that time I didn't remember that I can make buttons invisible  :-[ ;) Changing the whole code is too much of a hassle now...