[Lua] 纯文本查看 复制代码 local norecoil = false
local click = false
function OnEvent(event, arg)
OutputLogMessage("event = %s, arg = %d\n", event, arg)
EnablePrimaryMouseButtonEvents(true)
HOTKEY = "MOUSE_BUTTON_PRESSED"
single = 8 ----开火键(鼠标G键,默认8为G8既G502左键旁边俩键前边那个键)
off = 6----关闭
mod1 = 1----参数1
---------mod1---------------
if (event == HOTKEY and arg == mod1) then
norecoil = true
OutputLogMessage("norecoil mod1\n")
-------全自动---------
zyx = 2----首发强度
xzy = 1----持续强度
yxz = 18----压枪间隔
-------半自动---------
yzx = 12----首发强度
zzz = 1.9----持续强度
end
----------------------------------------------
-------------no recoil------------------------
----------------------------------------------
if (event == "MOUSE_BUTTON_PRESSED" and arg == 1 and norecoil and not IsModifierPressed("lalt")) then
Sleep(20)
MoveMouseRelative(0, zyx)
repeat
MoveMouseRelative(0, xzy)
Sleep(yxz)
until not IsMouseButtonPressed(1)
end
----------------------------------------------
--------------single--------------------------
----------------------------------------------
if (event == "MOUSE_BUTTON_PRESSED" and arg == single and norecoil) then
PressMouseButton(1)
Sleep(20)
ReleaseMouseButton(1)
MoveMouseRelative(0, yzx)
click = true
SetMKeyState(3)
end
if (event == "MOUSE_BUTTON_RELEASED" and arg == single) then
click = false
end
if (event == "M_RELEASED" and arg == 3 and click) then
PressMouseButton(1)
Sleep(20)
ReleaseMouseButton(1)
MoveMouseRelative(0, zzz)
if click then
SetMKeyState(3)
end
end
----------------------------------------------
--------------mouse---------------------------
----------------------------------------------
if (event == HOTKEY and arg == off) then
norecoil = false
OutputLogMessage("norecoil off\n")
end
----------------------------------------------
----------------------------------------------
----------------------------------------------
end
这个宏现在是直接长按左键就开始运行,
我想修改为按鼠标上的某个键以后脚本开启,长按左键压枪,
再按那个键以后脚本关闭,长按左键也不压枪了,
我的鼠标是G502,修改哪个代码或者加什么代码可以实现我的需求,谢谢大佬们 |