I have a small macro for my Logitech G500s - i'm using it in FPS games to reduce recoil. Please see script below:
EnablePrimaryMouseButtonEvents(true)
function OnEvent(event, arg)
if event == "MOUSE_BUTTON_PRESSED" and arg == 1 then
repeat
MoveMouseRelative(-1,2)
Sleep(16)
until not IsMouseButtonPressed(1)
end
end
Problem is that this script is works constantly. I wish rather to push another button1 to start using script on button2 and re-press button1 to break script
I was trying to set up the flags such as:
unction OnEvent(event, arg)
if event == "MOUSE_BUTTON_PRESSED" and arg == 6 then --set flag for mb1
mb1_pressed = true
elseif event == "MOUSE_BUTTON_RELEASED" and arg == 6 then --set flag for mb1=false
mb1_pressed = false
end
If mb1_pressed then
if event == "MOUSE_BUTTON_PRESSED" and arg == 1 and then
repeat
MoveMouseRelative(-1,2)
Sleep(16)
until not IsMouseButtonPressed(1)
end
end
but it does not work. Could you please help me ?