加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 大数据 > 正文

lua – 结合击键和鼠标点击的罗技脚本

发布时间:2020-12-14 21:49:48 所属栏目:大数据 来源:网络整理
导读:当我用鼠标左键同时按住左键控制键时,我正在尝试制作一个反复点击鼠标左键的脚本 这是我到目前为止: function OnEvent(event,arg,family) OutputLogMessage("clicked event = %s,arg = %sn",event,arg); if event == "MOUSE_BUTTON_PRESSED" and arg == 1
当我用鼠标左键同时按住左键控制键时,我正在尝试制作一个反复点击鼠标左键的脚本

这是我到目前为止:

function OnEvent(event,arg,family)
  OutputLogMessage("clicked event = %s,arg = %sn",event,arg);
 if event == "MOUSE_BUTTON_PRESSED" and arg == 1 and Ctrl_Down == 1 then
      repeat
      PressMouseButton(1) //repeat while the left mouse button down
      until not PressMouseButton(1)
     else ReleaseMouseButton(3) //stop the repating on left mouse button up
  end

end

请注意,这是我第一次查看此类编码,因为非常感谢任何帮助

解决方法

首先,您必须定义EnablePrimaryMouseButtonEvents()以启用鼠标按钮1的事件报告

要避免任何无限循环,你必须放入sleep();

Press left control key then left mouse button it will repeat the click
until you release the left mouse button then release left control key
the script should be stopped

你的最终代码应该是:

EnablePrimaryMouseButtonEvents(true);

function OnEvent(event,arg)
    if IsModifierPressed("lctrl") then
        repeat  
            if IsMouseButtonPressed(1) then
                repeat
                    PressMouseButton(1)
                    Sleep(15)
                    ReleaseMouseButton(1)
                until not IsMouseButtonPressed(1)
            end             
        until not IsModifierPressed("lctrl")
    end         
end

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读