So I am trying to code a rapidfire-script using a mouse hook to detect when the left mouse button has been pressed. The only problem is, when I send a click to the game (to fire the weapon) it gets detected via the mouse hook and so it results in an infinite loop. I don't want to use an additional hotkey (like H) in the game to fire the weapon because that requires input from the user (settings H to fire). I once saw a AHK/AutoIT script which does this, but I'm not familiar with this language.
Code:
*lbutton::
Loop
{
GetKeyState, state, lbutton, P
if State = U
break
Send, {lbutton}
Sleep, 0.1
}
return
I don't see what it does different. I guess my question comes down to: Is there a way to send a left mouse click to a process, without it getting detected by a Mousehook?
// Edit: Oh btw, I am using GetAsyncKeyState(0x01) == -32768 to check if the left mouse button is pressed or not.