Adventure Game Studio

AGS Support => Advanced Technical Forum => Topic started by: Fekix on Sun 07/03/2004 17:31:14

Title: mouseclick in gui
Post by: Fekix on Sun 07/03/2004 17:31:14
If i press and hold my right mouse button an actionmenu pop-ups where i can choose different interactions. However íf i right click over a GUI it don't pop up. I need this for my Inventory GUI. Does anyone know how to recognize the right click over a GUI to pop up a new GUI?
Title: Re:mouseclick in gui
Post by: Paper Carnival on Sun 07/03/2004 18:50:09
first, you have to create your own inventory GUI. Then, you must check "Handle Inventory clicks in script", in general settings. Then, in the on_mouse_click function you put:

if (button == RIGHTINV) {
//do something
}
if (button == LEFTINV) {
//do something
}

I'm getting a bit offtopic now, but I think you should know that this:
if (button==WHEELNORTH) {
//dosomething
}
if (button==WHEELSOUTH) {
//dosomething
}
triggers the mouse wheel (you have to check "Enable mouse wheel support" in the general settings). Just in case you didn't know that, I said this because it's kinda relevant to your question
Title: Re:mouseclick in gui
Post by: Ishmael on Sun 07/03/2004 18:53:03
You will need to do this with the repeadetly_execute function...

Put into the repeadetly_execute:

if (IsButtonDown(RIGHT)) {
//the actionmenu pupup code
} else {
//the actionmenu off code, something like GUIOff(...);
}
Title: Re:mouseclick in gui
Post by: Fekix on Sun 07/03/2004 20:34:32
thank you both for your suggestions but i already solved my problem with the "on_event" function and it works fine :)