--作者 Haidnor-
--全局功能定义区-------------------------------
--是否允许控制台报告开启状态
consoleReport = true
--是否开启控制台输出按键事件和按键编号
outputEventAndArg = false
--入口函数区------------------------------------
function OnEvent(event,arg)
if (event == "PROFILE_ACTIVATED") then
EnablePrimaryMouseButtonEvents(true)
elseif event == "PROFILE_DEACTIVATED" then
EnablePrimaryMouseButtonEvents(false)
end
if outputEventAndArg then
ClearLog()
OutputLogMessage("event = %s, arg = %d\n", event, arg)
end
main(event,arg)
end
--主函数,所有的鼠标按键事件都从该函数进入
--event 鼠标事件
--arg 鼠标按键参数
main = function(event,arg)
if event == "MOUSE_BUTTON_PRESSED" and arg == 1 then
mouseKey1(event,arg)
elseif event == "MOUSE_BUTTON_PRESSED" and arg == 2 then
mouseKey2(event,arg)
elseif event == "MOUSE_BUTTON_PRESSED" and arg == 3 then
mouseKey3(event,arg)
elseif event == "MOUSE_BUTTON_PRESSED" and arg == 4 then
mouseKey4(event,arg)
elseif event == "MOUSE_BUTTON_PRESSED" and arg == 5 then
mouseKey5(event,arg)
elseif event == "MOUSE_BUTTON_PRESSED" and arg == 6 then
mouseKey6(event,arg)
elseif event == "MOUSE_BUTTON_PRESSED" and arg == 7 then
mouseKey7(event,arg)
elseif event == "MOUSE_BUTTON_PRESSED" and arg == 8 then
mouseKey8(event,arg)
elseif event == "MOUSE_BUTTON_PRESSED" and arg == 9 then
mouseKey9(event,arg)
elseif event == "MOUSE_BUTTON_PRESSED" and arg == 10 then
mouseKey10(event,arg)
elseif event == "MOUSE_BUTTON_PRESSED" and arg == 11 then
mouseKey11(event,arg)
end
end
--按键功能设置区--------------------------------
mouseKey1 = function(event,arg)
fireMode2()
end
mouseKey2 = function(event,arg)
end
mouseKey3 = function(event,arg)
end
mouseKey4 = function(event,arg)
end
mouseKey5 = function(event,arg)
setFunctionalStatus()
end
mouseKey6 = function(event,arg)
bindKey_m()
end
mouseKey7 = function(event,arg)
end
mouseKey8 = function(event,arg)
end
mouseKey9 = function(event,arg)
end
mouseKey10 = function(event,arg)
end
mouseKey11 = function(event,arg)
end
--按键绑定函数区--------------------------------
--按键绑定,LCtrl + 鼠标滚轮向上滚动一格
bindKey_LCtrl_MouseWheelUp1 = function()
PressKey(0x1d)
Sleep(50)
MoveMouseWheel(1)
Sleep(50)
ReleaseKey(0x1d)
end
--按键绑定,LCtrl + 鼠标滚轮向下滚动一格
bindKey_LCtrl_MouseWheelDown1 = function()
PressKey(0x1d)
Sleep(50)
MoveMouseWheel(-1)
Sleep(50)
ReleaseKey(0x1d)
end
--按键绑定,m
bindKey_m = function()
PressAndReleaseKey(0x32)
end
--按键绑定,1
bindKey_1 = function()
PressAndReleaseKey(0x02)
end
--函数封装区------------------------------------
--清空控制台内容然后打印制定信息
--text 自定义字符串
clearAndPrint = function(text)
if consoleReport == true then
ClearLog()
OutputLogMessage(text)
end
end
--移动鼠标后暂停指定时间
--x x轴移动距离
--y y轴移动距离
--ms 移动后暂停时间
sleepAfterMoveMouse = function(x,y,ms)
if ms == nil then
ms = 0
end
MoveMouseRelative(x,y)
Sleep(ms)
end
--移动鼠标之前暂停指定时间
--x x轴移动距离
--y y轴移动距离
--ms 移动后暂停时间
sleepBeforeMoveMouse = function(x,y,ms)
Sleep(ms)
MoveMouseRelative(x,y)
end
--按下指定按键在指定时间后释放
--key 按键值
--ms 按下按键后距离释放的时间
pressAndReleaseKeySetSleepTime = function(key,ms)
PressKey(key)
Sleep(ms)
ReleaseKey(key)
end
--功能开关
--双击间隔小于200ms为开
--单击间隔大于200ms为关
lastTime = 0
functionalStatus = false --全局开关变量,控制鼠标所有功能
setFunctionalStatus = function()
if GetRunningTime() - lastTime > 300 then
lastTime = GetRunningTime()
functionalStatus = false
clearAndPrint(">>>Function false")
else
lastTime = GetRunningTime()
functionalStatus = true
clearAndPrint(">>>Function true")
end
end
--连发,自动压枪
fireMode1 = function()
y = 8
increment = 0.4
if functionalStatus then
while (IsMouseButtonPressed(1))
do
sleepBeforeMoveMouse(-1,y,33)
y = y + increment
end
end
end
--连续单点,自动压枪
-- 俄军ak 4倍镜 鼠标移动参数 y=9 increment=0.15
-- 车臣ak 8倍镜 鼠标移动参数 y=15 increment=0.2
-- 英军L85A2 4倍镜 鼠标移动参数 y=8 increment=0.1
-- 美军m4 4倍镜 鼠标移动参数 y=15 increment=0.4
-- 美军m4 2倍镜 鼠标移动参数 y=6.4 increment=0.131
fireMode2 = function()
y = 9
increment = 0.15
if functionalStatus then
while (IsMouseButtonPressed(1))
do
MoveMouseRelative(0,y)
y = y + increment
PressMouseButton(1)
Sleep(33)
ReleaseMouseButton(1)
end
end
end