Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: on Tue 12/05/2009 19:46:20

Title: GUI mouse-overs?? (was Simple int to string theory)
Post by: on Tue 12/05/2009 19:46:20
I have a simple script question because I cannot access the game files where I've used this code before.

I have a slider called "count" and I have a label called "displaycount" that I want to display the number the slider is currently at, ie 1 to 100. I think it has something to do with calling StrFormat but I really don't understand what the help guide is telling me.

Can someone please post me the code?

Many thanks :)
Title: Re: Simple int to string theory
Post by: Khris on Tue 12/05/2009 20:14:57
displaycount.Text = String.Format("%d", count.Value);
Title: Re: Simple int to string theory
Post by: on Tue 12/05/2009 21:04:53
Well, that was stupidly easy - thanks Khris!

I'm sure this post'll be updated with fresh questions pretty soon :)
Title: Re: Simple int to string theory
Post by: Khris on Tue 12/05/2009 21:53:42
You're welcome :)
Title: Re: GUI mouse-overs?? (was Simple int to string theory)
Post by: on Wed 13/05/2009 14:56:05
Cool! Well I have another question, hopefully simple!

I have 2 GUIs. GUI 1 has a label text in it which changes over various hotspots, simple. GUI 2 has a button in it that when I move the mouse over it I want the label text in GUI 1 to display it.

However there doesn't seem to be a simple "is mouse over button" command, can it be replicated somehow? Obviously it's not about changing the mouseover graphic, but simply some way of AGS recognising my mouse being over the button.

Any help appreciated :)
Title: Re: GUI mouse-overs?? (was Simple int to string theory)
Post by: Khris on Wed 13/05/2009 15:27:27
Something like this should do the trick:

// inside repeatedly_execute

  GUIControl*gc = GUIControl.GetAtScreenXY(mouse.x, mouse.y);
  if (gc == button_name_here) label.Text = "button";
  else label.Text = "@OVERHOTSPOT@";
Title: Re: GUI mouse-overs?? (was Simple int to string theory)
Post by: on Wed 13/05/2009 18:37:22
Perfect, thanks! :)