EnablePrimaryMouseButtonEvents (true)
local click = false
local recoil = false
local step = 2.0
function OnEvent(event, arg)
OutputLogMessage("event = %s, arg = %d\n", event, arg)
if (event == "PROFILE_ACTIVATED") then
EnablePrimaryMouseButtonEvents(true)
end
if (event == "MOUSE_BUTTON_PRESSED" and arg == 3) then
recoil = false
end
if (event == "MOUSE_BUTTON_PRESSED" and arg == 6) then
recoil = false
end
if (event == "MOUSE_BUTTON_PRESSED" and arg == 5) then
if (recoil == false) then
step = 2.0
recoil = true
else
step = step * 0.8
end
end
if (event == "MOUSE_BUTTON_PRESSED" and arg == 4) then
if (recoil == false) then
step = 2.0
recoil = true
else
step = step * 1.25
end
end
if (event == "MOUSE_BUTTON_PRESSED" and arg == 1 and recoil and not IsModifierPressed("lalt")) then
click = true
SetMKeyState(3)
end
if (event == "MOUSE_BUTTON_RELEASED" and arg == 1) then
click = false
end
if (event == "M_RELEASED" and arg == 3 and click) then
PressMouseButton(1)
Sleep(30)
ReleaseMouseButton(1)
MoveMouseRelative(0, step)