我参考罗技编程参考文档,写了一个连点的宏,但是在使用的时候会出现掉帧情况,游戏老玩家知道,掉帧会影响弹道
有没有办法可以减少掉帧情况出现?
以下是代码
ytime = 14--延迟
KG = 5--鼠标开关
KG2= 4--开关2
func_num = 0
On = false--初始状态
Onclick = false
function OnEvent(event, arg)
EnablePrimaryMouseButtonEvents(true)
--开关1
if (event == "MOUSE_BUTTON_PRESSED" and arg == KG) then
On = not On
if (On) then
func_num = 1
PressAndReleaseKey("capslock")--开启连点的时候大小写灯亮起
OutputLogMessage("kai \n")
else
func_num = 0
ReleaseKey("capslock")
OutputLogMessage("guan \n")
end
--判断大小写灯是否亮着,亮的话就再次点击就关闭
if (IsKeyLockOn("capslock")) then
PressAndReleaseKey("capslock")
end
end
--开关2
if (event == "MOUSE_BUTTON_PRESSED" and arg == KG2) then
On = not On
if (On) then
func_num = 2
PressAndReleaseKey("capslock")
OutputLogMessage("kai2 \n")
else
func_num = 0
OutputLogMessage("guan2 \n")
end
--判断大小写灯是否亮着,亮的话就再次点击就关闭
if (IsKeyLockOn("capslock")) then
PressAndReleaseKey("capslock")
end
end
--鼠标左键被按下且是开始状态
if (event == "MOUSE_BUTTON_PRESSED" and arg == 1 and On) then
SetMKeyState(1)
Onclick = true
--点击结束
elseif (event == "MOUSE_BUTTON_RELEASED" and arg == 1) then
Onclick = false
end
--判断开关调用方法
if event == "M_PRESSED" and arg == 1 and On then
if func_num == 1 then
lj()
elseif func_num == 2 then
yqlj()
end
end
end
--连点方法
function lj()
PressAndReleaseMouseButton(1)
if (Onclick) then
Sleep(ytime)
SetMKeyState(1)
end
end
--压枪连点方法
function yqlj()
PressAndReleaseMouseButton(1)
zy=0.0--zy是左右抖动的幅度0.085
cz=2.95
MoveMouseRelative(zy,0)
Sleep(3)
MoveMouseRelative(0,cz)
Sleep(3)
MoveMouseRelative(-zy,0)
if (Onclick) then
Sleep(ytime)
SetMKeyState(1)
end
end