精通LUA语言的大神帮忙 10
以下代码是按键6按一下,打开宏开关,按键6在按一下,关闭宏开关。我想改成只有当按键6长按不放时,才能出发宏开关,按键6放开时就不触发宏开关。跪求大神。‘’EnablePr...
以下代码是按键6按一下,打开宏开关,按键6在按一下,关闭宏开关。
我想改成只有当按键6长按不放时,才能出发宏开关,按键6放开时就不触发宏开关。
跪求大神。
‘’
EnablePrimaryMouseButtonEvents (true)
function OnEvent(event, arg, family)
if (event == "PROFILE_ACTIVATED") then
EnablePrimaryMouseButtonEvents(true)
click = 0
end
if (event == "MOUSE_BUTTON_PRESSED" and arg == 6) then
recoil = not recoil
end
if (event == "MOUSE_BUTTON_PRESSED" and arg == 1 and recoil) then
click = 1
Click()
end
if (event == "M_RELEASED" and arg == 3) then
Click()
end
if (event == "MOUSE_BUTTON_RELEASED" and arg == 1) then
Stopclick()
end
end
function Click()
PressAndReleaseMouseButton(1)
Sleep (7)
MoveMouseRelative(0, 2.5)
if click == 0 then
Stopclick()
elseif click == 1 then SetMKeyState(3)
else Stopclick()
end
end
function Stopclick()
click = 0
end 展开
我想改成只有当按键6长按不放时,才能出发宏开关,按键6放开时就不触发宏开关。
跪求大神。
‘’
EnablePrimaryMouseButtonEvents (true)
function OnEvent(event, arg, family)
if (event == "PROFILE_ACTIVATED") then
EnablePrimaryMouseButtonEvents(true)
click = 0
end
if (event == "MOUSE_BUTTON_PRESSED" and arg == 6) then
recoil = not recoil
end
if (event == "MOUSE_BUTTON_PRESSED" and arg == 1 and recoil) then
click = 1
Click()
end
if (event == "M_RELEASED" and arg == 3) then
Click()
end
if (event == "MOUSE_BUTTON_RELEASED" and arg == 1) then
Stopclick()
end
end
function Click()
PressAndReleaseMouseButton(1)
Sleep (7)
MoveMouseRelative(0, 2.5)
if click == 0 then
Stopclick()
elseif click == 1 then SetMKeyState(3)
else Stopclick()
end
end
function Stopclick()
click = 0
end 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询