Logitech Lua 将 Rapid Fire 与喷雾结合

所以基本上,我脚本现在看起来像这样,它是一个快速射击宏并减少枪支后座力,但是我无法用这个脚本喷洒,因为它很慢,因为我猜它减少了后座力。我想知道是否可以像正常喷雾一样,一次射出4、5颗子弹,没有后座力(只能在按住鼠标3时自动射击,而不能在轻击鼠标时自动射击),并在已经按住鼠标3的情况下继续喷雾,没有延迟。如果有任何疑问,请帮忙解答。

EnablePrimaryMouseButtonEvents(true);

function OnEvent(event, arg)
    if IsKeyLockOn("scrolllock")then
        if IsMouseButtonPressed(3) then
            repeat
                if IsMouseButtonPressed(3) then
                    repeat
                        PressMouseButton(1)
                        Sleep(15)
                        ReleaseMouseButton(1)
                    until not IsMouseButtonPressed(3)
                end
            until not IsMouseButtonPressed(3)
        end
    end
end
点赞
用户1847592
用户1847592
local rapid_fire_delay = 15  -- LMB 按下/释放模拟间隔时间
local LMB_Pressed

-- 初始化 PRNG(伪随机数生成器)
do
   local dt = 0
   for c in GetDate():gmatch"." do
      dt = (dt % 65537 * 23456 + c:byte())
   end
   math.randomseed(dt)
end

function OnEvent(event, arg)
   -- RMB 按下,且 Scroll Lock 键已开启
   if event == "MOUSE_BUTTON_PRESSED" and arg == 2 and IsKeyLockOn("scrolllock") then
      -- 前 4 或 5 发使用快速连发
      for j = 1, math.random(4, 5) do
         PressMouseButton(1)
         Sleep(math.random(rapid_fire_delay, 2 * rapid_fire_delay))
         ReleaseMouseButton(1)
         Sleep(math.random(rapid_fire_delay, 2 * rapid_fire_delay))
         -- 如果 RMB 没有被按下,返回
         if not IsMouseButtonPressed(3) then
            return
         end
      end
      -- 剩余发数正常连发
      PressMouseButton(1)
      LMB_Pressed = true
   -- RMB 释放
   elseif event == "MOUSE_BUTTON_RELEASED" and arg == 2 and LMB_Pressed then
      ReleaseMouseButton(1)
      LMB_Pressed = false
   -- 侧键 2 按下
   elseif event == "MOUSE_BUTTON_PRESSED" and arg == 5 then
      repeat
         Sleep(15)
         PressKey("SPACEBAR")
         Sleep(15)
         ReleaseKey("SPACEBAR")
      until not IsMouseButtonPressed(5)
   end
end

for j = 1, math.random(4, 5) do 的这行代码意思是“发射 4 到 5 发子弹”。

如果你需要确切的 3 发子弹,将这一行代码修改为 for j = 1, 3 do


编辑:

以下是让快速连发只在 LMB 双击后才触发的指示。

单独的 LMB 按下不会触发快速连发。

local Prev_LMB_Time, LMB_Pressed = 0
function OnEvent(event, arg)
   if event == "MOUSE_BUTTON_PRESSED" and arg == 1 then
      if IsKeyLockOn("scrolllock") then
         local tm = GetRunningTime()
         tm, Prev_LMB_Time = tm - Prev_LMB_Time, tm
         if tm < 200 then -- LMB 双击
            for j = 1, 100 do
               PressMouseButton(1)
               Sleep(1)
               ReleaseMouseButton(1)
               Sleep(1)
               if not IsMouseButtonPressed(4) then
                  return
               end
            end
         end
      end
      PressMouseButton(1)
      LMB_Pressed = true
   elseif event == "MOUSE_BUTTON_RELEASED" and arg == 1 and LMB_Pressed then
      ReleaseMouseButton(1)
      LMB_Pressed = false
   elseif event == "MOUSE_BUTTON_PRESSED" and arg == 5 then
      repeat
         Sleep(15)
         PressKey("SPACEBAR")
         Sleep(15)
         ReleaseKey("SPACEBAR")
      until not IsMouseButtonPressed(5)
   end
end

当前的 GHUB 设置为:

Primary Click = G1
Back          = G4 G8

应该在 GHUB 中进行以下设置(按照以下顺序):

  1. 在 G8 上绑定“Primary Click”(从此使用按钮 #8 代替 LMB)
  2. 在 G1 上绑定“Back”
  3. 设置脚本
现在你的设置如下:
Primary Click = G8
Back          = G1 G4

现在鼠标的按钮 #8 现在是备用 LMB,以防 LMB 工作不正常。

2020-07-05 04:36:41