function OnEvent(event, arg)
OutputLogMessage("event = %s, arg = %d\n", event, arg)
if (event == "PROFILE_ACTIVATED") then
EnablePrimaryMouseButtonEvents(true)
elseif event == "PROFILE_DEACTIVATED" then
ReleaseMouseButton(2) -- to prevent it from being stuck on
end
if (event == "MOUSE_BUTTON_PRESSED" and arg == 5) then
recoil = not recoil
spot = not spot
end
if (event == "MOUSE_BUTTON_PRESSED" and arg == 1 and recoil) then
--Sleep(35)
if recoil then
repeat
MoveMouseRelative(0, 2)
PressMouseButton(1)
Sleep(7)
ReleaseMouseButton(1)
until not IsMouseButtonPressed(1)
end
end
end
PressMouseButton(1),ReleaseMouseButton(1)
function OnEvent(event, arg)
OutputLogMessage("event = %s, arg = %d\n", event, arg)
if (event == "PROFILE_ACTIVATED") then
EnablePrimaryMouseButtonEvents(true)
elseif event == "PROFILE_DEACTIVATED" then
ReleaseMouseButton(2) -- to prevent it from being stuck on
end
if (event == "MOUSE_BUTTON_PRESSED" and arg == 5) then
recoil = not recoil
spot = not spot
end
if (event == "MOUSE_BUTTON_PRESSED" and arg == 1 and recoil) then
if recoil then
repeat
--Sleep(35)
Sleep(8)
MoveMouseRelative(0, 2)
until not IsMouseButtonPressed(1)
end
end
end
local recoil = false local aim = false
sleep_duration = 50
MaxBreak = 1000
TimeStamp = -MaxBreak-1 -- it's negative 2 seconds
recoil_coords = {
{ x = -2, y = 5 },
{ x = -2, y = 5 },
{ x = -3, y = 5 },
{ x = -3, y = 5 },
{ x = -3, y = 5 },
{ x = -3, y = 5 },
{ x = -3, y = 5 },
{ x = -3, y = 5 },
{ x = -3, y = 5 },
{ x = -3, y = 5 },
{ x = -4, y = 8 },
{ x = -4, y = 8 },
{ x = -4, y = 8 },
{ x = -4, y = 8 },
{ x = -4, y = 8 },
{ x = -4, y = 8 },
{ x = -4, y = 8 },
{ x = -4, y = 8 },
{ x = -4, y = 8 },
{ x = -4, y = 8 },
{ x = -4, y = 8 },
{ x = -4, y = 8 },
{ x = -4, y = 8 },
{ x = -4, y = 8 },
{ x = -4, y = 8 },
{ x = -4, y = 8 },
{ x = -5, y = 9 },
{ x = -5, y = 9 },
{ x = -5, y = 9 },
{ x = -5, y = 9 },
{ x = -5, y = 9 },
{ x = -5, y = 9 },
{ x = -5, y = 9 },
{ x = -5, y = 9 },
{ x = -7, y = 10 },
{ x = -7, y = 10 },
{ x = -7, y = 10 },
{ x = -7, y = 10 },
{ x = -7, y = 10 },
{ x = -7, y = 10 },
{ x = -7, y = 10 },
{ x = -7, y = 10 },
{ x = -7, y = 10 },
{ x = -7, y = 10 },
{ x = -7, y = 10 },
{ x = -7, y = 10 },
{ x = -7, y = 10 },
{ x = -7, y = 10 },
{ x = -7, y = 10 },
{ x = -7, y = 10 },
{ x = -7, y = 10 },
{ x = -7, y = 10 },
{ x = -7, y = 10 },
{ x = -7, y = 10 },
{ x = -7, y = 10 },
{ x = -7, y = 10 },
{ x = -7, y = 10 },
{ x = -7, y = 10 },
{ x = -7, y = 10 },
{ x = -7, y = 10 },
{ x = -5, y = 8 },
{ x = -5, y = 8 },
{ x = -5, y = 8 },
{ x = -5, y = 8 },
{ x = -5, y = 8 },
{ x = -5, y = 8 },
{ x = -5, y = 8 },
{ x = -5, y = 8 },
{ x = -5, y = 8 },
{ x = -5, y = 8 },
{ x = -5, y = 8 },
{ x = -5, y = 8 },
{ x = -5, y = 8 },
{ x = -5, y = 8 },
{ x = -5, y = 8 },
}
recoil_count = # recoil_coords
LastIndex = 1
function OnEvent(event, arg)
if event == "PROFILE_ACTIVATED" then
EnablePrimaryMouseButtonEvents(true)
end
if (event == "MOUSE_BUTTON_PRESSED" and arg == 11) then -- Press mouse button 11 to toggle recoil
recoil = not recoil
if (recoil == false) then
OutputLogMessage("RecoilScript turned OFF\n")
else
OutputLogMessage("RecoilScript turned ON\n")
end
end
if (event == "MOUSE_BUTTON_PRESSED" and arg == 1) and recoil then
if (GetRunningTime() - TimeStamp < MaxBreak) and (LastIndex <= recoil_count) then
i = LastIndex
else
i = 1
end
while i <= recoil_count do
Sleep(sleep_duration)
if not IsMouseButtonPressed(1) then
LastIndex = i
TimeStamp = GetRunningTime()
break
end
MoveMouseRelative( recoil_coords[i].x, recoil_coords[i].y )
if not IsMouseButtonPressed(1) then break end
i = i + 1
end
end
if event == "MOUSE_BUTTON_PRESSED" and arg == 2 and recoil then
PressKey("Spacebar")
PressAndReleaseKey("J")
PlayMacro("DPI Down")
else
if event == "MOUSE_BUTTON_RELEASED" and arg == 2 then
ReleaseKey("Spacebar")
PressAndReleaseKey("J")
PlayMacro("DPI Up")
end
end
end
local recoil = false
function OnEvent(event, arg)
if event == "PROFILE_ACTIVATED" then
EnablePrimaryMouseButtonEvents(true)
end
if (event == "MOUSE_BUTTON_PRESSED" and arg == 11) then -- Press mouse button 11 to toggle recoil
recoil = not recoil
if (recoil == false) then
OutputLogMessage("RecoilScript turned OFF\n")
else
OutputLogMessage("RecoilScript turned ON\n")
end
end
if (event == "MOUSE_BUTTON_PRESSED" and arg == 1) and recoil then
if IsMouseButtonPressed(1) then
repeat
PressKey("M")
Sleep(50)
ReleaseKey("M")
MoveMouseRelative(-2,3)
if not IsMouseButtonPressed(1) then break end
PressKey("M")
Sleep(50)
ReleaseKey("M")
MoveMouseRelative(-3,5)
if not IsMouseButtonPressed(1) then break end
PressKey("M")
Sleep(50)
ReleaseKey("M")
MoveMouseRelative(-4,6)
if not IsMouseButtonPressed(1) then break end
until not IsMouseButtonPressed(1)
end
end
if event == "MOUSE_BUTTON_PRESSED" and arg == 2 and recoil then
SetMouseDPITableIndex(1)
PressKey("Spacebar")
PressAndReleaseKey("J")
else
if event == "MOUSE_BUTTON_RELEASED" and arg == 2 then
SetMouseDPITableIndex(2)
ReleaseKey("Spacebar")
PressAndReleaseKey("J")
end
end
end