Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: .M.M. on Fri 26/10/2007 15:12:51

Title: Custom GUI
Post by: .M.M. on Fri 26/10/2007 15:12:51
What's wrong in that script???

if (interface == VLASTNOSTI) {   
    if (button == 5) {
      gVlastnosti.Visible == false ;
    }
  }
Title: Re: Custom GUI
Post by: VK Dan on Fri 26/10/2007 15:15:53
EDIT: Actually, I see the error. Instead of

      gVlastnosti.Visible == false ;

it should be

      gVlastnosti.Visible = false ;

the == says "is it equal to?" while = says "make it equal to"
Title: Re: Custom GUI
Post by: Khris on Fri 26/10/2007 15:52:55
And btw, the interface_click function is obsolete now.

The way to do it now is to name the button using the "Script name" field in its properties window, set "Left click" to "RunScript", then double-click its "Click" property. This will create/take you to the function.
Title: Re: Custom GUI
Post by: VK Dan on Fri 26/10/2007 16:25:48
Or you could do what I do...just double click the button and it will create/take you to the function. :P

EDIT: No need to quote the entire previous post.
Title: Re: Custom GUI
Post by: Khris on Fri 26/10/2007 17:37:25
True, but you still have to name the button and set "Left click" to "RunScript" first. :P
Title: Re: Custom GUI
Post by: VK Dan on Fri 26/10/2007 22:12:32
I suppose that's true in the 3.0 betas. I was thinking of AGS 2.72.
Title: Re: Custom GUI
Post by: Ashen on Fri 26/10/2007 22:38:02
'Left click' is the default action in 2.72, so while it DOES need to be set to that, YOU (the AGSer) don't have to do it. Unless you've set it to one of the others previously. You DO have to name the Button, though.

But that's beside the point. Mirek, if you're using 2.7 or later, you shouldn't be using interface_click. It works, but it's not good practice. If you're using an earlier version, then carry on. (Once you've made the correction VK Dan gave you.)
Also, in future, make your posts a little more descriptive - why do you think there's something wrong, what is/isn't it doing. is there an error message, etc. Not necessary here, as the problem was so obvious (and I'd guess it was a 'parse error at ... ' error message), but keep it in mind.
Title: Re: Custom GUI
Post by: .M.M. on Sat 27/10/2007 09:21:15
O.K. so if I don't have to use interface_click where do I have to place my script?
Title: Re: Custom GUI
Post by: Khris on Sat 27/10/2007 09:51:25
Did you try this:
Quote from: KhrisMUC on Fri 26/10/2007 15:52:55The way to do it now is to name the button using the "Script name" field in its properties window, set "Left click" to "RunScript", then double-click its "Click" property. This will create/take you to the function.
?
Following these steps will create a function called ButtonName_Click(...).

In there is where your code goes.
Title: Re: Custom GUI
Post by: .M.M. on Sun 28/10/2007 15:07:13
Button_click is great idea! :o :o :o It´s really easy to use it!
Title: Re: Custom GUI
Post by: Dualnames on Tue 30/10/2007 08:43:51
Actually you could change VLAwhatevery to the number of that GUI.