Adventure Game Studio

AGS Support => Advanced Technical Forum => Topic started by: monkey0506 on Sun 05/09/2004 02:17:18

Title: GetButtonPic? Possible suggestion for next version of AGS?
Post by: monkey0506 on Sun 05/09/2004 02:17:18
Is it possible to find out what the button picture is of the button at coordinates (mouse.x, mouse.y)? I'm trying to script keyboard control of the mouse cursor with the arrows moving the cursor (works), enter performing a left click (works), and tab performing a right click (works). I say that the left and right clicks work, but there is one complication. I have the script to run the on_mouse_click function for LEFT or RIGHT on enter and tab respectively. This doesn't highlight the buttons as the "pushed image" does when I left or right click with the mouse. I tried doing this:

SetButtonPic(GetGUIAt(mouse.x, mouse.y), GetGUIObjectAt(mouse.x, mouse.y), 1,

and then I encountered an error. I had hoped to use something like "GetButtonPic(GetGUIAt(mouse.x, mouse.y), GetGUIObjectAt(mouse.x, mouse.y))+1", but GetButtonPic isn't one of the engine's functions... Does anyone know how to do this?

EDIT: I forgot to mention, and not sure if it matters, but I want keyboard AND mouse control of the mouse cursor.

EDIT: I just searched the forums, and found that Goot asked a similar question nearly a month ago. He seemed to know an alternate, although lengthy way of doing it involving ints? Also, could this function perhaps become a suggestion for the next version of AGS? I would like to see this if it is possible...  ;D
Title: Re: GetButtonPic? Possible suggestion for next version of AGS?
Post by: Edwin Xie on Sun 05/09/2004 03:23:25
Hmm...I don't know...it doesn't sound useful to me...... :-\
Title: Re: GetButtonPic? Possible suggestion for next version of AGS?
Post by: Moox on Sun 05/09/2004 05:22:27
I would find it usefull for my current project
Title: Re: GetButtonPic? Possible suggestion for next version of AGS?
Post by: Mr Jake on Sun 05/09/2004 07:55:03
you can do it just by adding 'SetGlobalInt(button#, sprite#)' after each SetButtonPic
Title: Re: GetButtonPic? Possible suggestion for next version of AGS?
Post by: monkey0506 on Sun 05/09/2004 15:20:36
Yes, but then I would have to set each normal button pic, and then set the global variable, and then in on right click, test the global variable, then set the appropriate button pic (pushed pic, but in the normal slot so it looks pushed) and then set the same button back... It seems kind of lengthy. Is there another way?

EDIT: I'm renumbering my buttons so I can create a couple of custom functions that will handle this. I have to go to church, so when I get back I'll elaborate more.

function GetNormalButtonPic(something will probably go here){
//stuff
}
function GetPushedButtonPic(diddo){
//more stuff
}
Title: Re: GetButtonPic? Possible suggestion for next version of AGS?
Post by: Mr Jake on Sun 05/09/2004 17:01:24
its not really that length, its an extra line of code each time you change the button pic :/
Title: Re: GetButtonPic? Possible suggestion for next version of AGS?
Post by: Scorpiorus on Sun 05/09/2004 19:39:13
Yep, something like GetButtonPic(int gui, int object, int which) would definitely be useful in that case.
Title: Re: GetButtonPic? Possible suggestion for next version of AGS?
Post by: Pumaman on Mon 06/09/2004 21:07:26
Ok, I'll add it to my list.
Title: Re: GetButtonPic? Possible suggestion for next version of AGS?
Post by: monkey0506 on Tue 07/09/2004 01:18:19
w00t!!! Not only did I make the tech forum, I made a useful suggestion! Wait, this post kind of cancels out the cancellation of some of my n00b status doesn't it? Dang it...