I want to make a GUI button behave differently, depending on if it's the left or right mouse that called it. I tried mouse.IsButtonDown(eMouseLeft) but that doesn't work (I'm guessing because the button is triggered by the mouse being released).
Do I need to use repExAlways and constantly check if the mouse is pressed over a button? Or is there a simpler way?
Ok, we all probably got stuck with a similar problem, so nevermind.
At the button you have created (let's name it's script name as Button1).
Put this on the button's interaction.
if (button==eMouseLeft) {
//code//
}
if (button==eMouseRight) {
//code//
}
(I'm assuming you're using AGS 3.0 and higher)
Quote from: Dualnames on Tue 25/11/2008 17:47:07
(I'm assuming you're using AGS 3.0 and higher)
That explains it. I saw the 'button ==' code in other threads, but it doesn't compile in 2.72 (which I use for Linux compatibility).
I have a compromise where RepExAlways constantly updates 'lastMouseButtonClicked' and the GUI button code looks at that. It seems to work, but I wondered if there was a solution that could be completely contained within the GUI button.
Oh, shit, I just saw it was you. I was aware you're using AGS 2.72..Ok, so..
Well, there's a way, probably not a one definetely working but it might as well.
Ok go to the global script header and add this:
bool rightclicked=false;
At the on_mouse_click section put something like this:
if (button==eMouseRight) {
rightclicked=true;
}
else {
rightclicked=false;
}
then at the buttons function part put this:
if (rightclicked==true) {
//code//
}
The code from Dualnames' first post will work perfectly fine with 2.72.