【问题标题】:Lua api script change hold key to toggleLua api脚本更改保持键以切换
【发布时间】:2021-09-09 02:49:54
【问题描述】:

嘿,我想修改这个脚本,现在我需要按住鼠标右键才能使脚本运行。我想将其更改为切换右键单击,然后在按住左键单击时让它运行,直到我再次按右键单击。有人知道怎么做吗?

EnablePrimaryMouseButtonEvents(true);
 
function OnEvent(event, arg)
    if IsKeyLockOn("numlock" )then
        if IsMouseButtonPressed(3)then
            repeat  
                if IsMouseButtonPressed(1) then
                    repeat
                        MoveMouseRelative(1,7)
                        Sleep(30)
                    until not IsMouseButtonPressed(1)
                end             
            until not IsMouseButtonPressed(3)
        end     
    end
end

【问题讨论】:

  • 你试过什么?你有什么问题?堆栈溢出不是编码服务,因为您现在的问题是“我有这段代码可以执行 y,有人可以让它为我执行 x”。
  • @Nifim - 你是对的。但是有一个问题:LGS没有好的教程。我通过阅读手册(只是 API 函数列表)和谷歌搜索其他人编写的脚本来学习它。没有别人的帮助,初学者是不可能学习 LGS 的。
  • @EgorSkriptunoff 这是一个公平的观点,但我认为 SO 是进行该交互的正确位置。我可以看到一个没有明确去处的人最终会在这里。

标签: lua logitech-gaming-software


【解决方案1】:

试试这个:

local recoil_mode

function OnEvent(event, arg)
   if event == "PROFILE_ACTIVATED" then
      EnablePrimaryMouseButtonEvents(true)
   elseif event == "MOUSE_BUTTON_PRESSED" and arg == 2 then
      recoil_mode = not recoil_mode
   elseif event == "MOUSE_BUTTON_PRESSED" and arg == 1 and recoil_mode and IsKeyLockOn("numlock") then
      repeat
         MoveMouseRelative(1,7)
         Sleep(30)
      until not IsMouseButtonPressed(1)
   end
end

【讨论】:

  • 我刚刚测试了这个,这基本上可以在我想要的主枪上工作,但不能在辅助枪上工作(就像没有脚本一样),看起来很奇怪在脚本中看不到具体原因
  • 什么是the secondary gun?你是怎么开火的?
  • 与主炮发射方式相同
  • 两支枪都在 LMB 上?
猜你喜欢
  • 2023-01-23
  • 1970-01-01
  • 2020-06-23
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2019-09-07
相关资源
最近更新 更多