Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: on Sat 09/04/2005 00:50:12

Title: AGS 2.7 / GetGUIObjectAt as an integer [SOLVED]
Post by: on Sat 09/04/2005 00:50:12
RE:  My custom scrolling dialog template -- I'm rescripting it in 2.7

Is there a way to get the integer value of the GUI object at a point, i.e., mouse.x, mouse.y?  I have something of a work-around:

short y = 143; /* y-value of GUI */
short my = mouse.y; /* y-value of cursor */
short objHeight = 8; /* height of GUI object */
short objAt = (mouse.y - y) / objHeight; /* object at cursor */


However, this doesn't exactly work the way I need it to now that I've made some changes.  I now have labels behind the seven I use for normal text display, and I shift the labels if the text of a dialog option is too long.  The problem is that this code returns an index of 0 - 6 when really I now need an index of 0 - 13...  I use this to determine which dialog to run when the user chooses an option.  Any help would be greatly appreciated.
Title: Re: AGS 2.7 / GetGUIObjectAt as an integer
Post by: strazer on Sat 09/04/2005 01:12:29
Quote
Is there a way to get the integer value of the GUI object at a point, i.e., mouse.x, mouse.y?


GUIControl *thecontrol = GUIControl.GetAtScreenXY(mouse.x, mouse.y);
if (thecontrol != null) integervalue = thecontrol.ID;
Title: Re: AGS 2.7 / GetGUIObjectAt as an integer
Post by: monkey0506 on Mon 11/04/2005 16:34:34
Ah...Thanks...