I'm looking to bind scripts to my mouse buttons, that only execute a function when a certain pixel is recognized on the screen.
When the pixel is not recognized or seen, the mouse buttons should behave as normal.
Right now I'm creating infinite loops though, where the function activates the trigger... Does anyone know a way how to fix this?
Code: Select all
Function(){
; if the pixel is detected do something, else I want the RButton to behave like normal, the else is causing problems here
PixelSearch, OutputVarX, OutputVarY, 788, 1008, 789, 1009, 0x9DB2A1, 1, Fast
if (ErrorLevel = 0){
While GetKeyState("RButton","P")
{
Send, {RButton Down}
Sleep, % ran(30, 60)
Send, {RButton Up}
Sleep, % ran(30, 60)
Click
Sleep, % ran(30, 60)
}
} else {
While GetKeyState("RButton","P")
{
Send, {RButton Down}
}
Send, {RButton Up}
}
Return
}
RButton::
Function()
Return