罗技 Lua 将 Rapid Fire 与喷雾相结合

Logitech Lua combining Rapid Fire with spray

所以基本上,这就是我的脚本目前的样子,它是一个快速射击宏并减少了枪支的后坐力,但是由于某种原因我永远无法使用这个脚本进行喷射,因为它非常慢,因为我猜它正在减少后坐力。我想知道我是否可以像 4、5 发子弹一样没有任何后坐力(只能在按住鼠标 3 时自动射击,而不是在点击时自动射击。)并在已经按住鼠标 3 的情况下像普通喷雾一样继续喷射而不会出现任何延迟。所以 4 发子弹没有后坐力,并在同一周期内停止常规喷雾。如果那有意义的话。任何帮助将不胜感激。

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

local rapid_fire_delay = 15   -- delay between simulation of LMB press/release
local LMB_Pressed
do  -- initializing PRNG
   local dt = 0
   for c in GetDate():gmatch"." do
      dt = (dt % 65537 * 23456 + c:byte())
   end
   math.randomseed(dt)
end

function OnEvent(event, arg)
   if event == "MOUSE_BUTTON_PRESSED" and arg == 2 and IsKeyLockOn("scrolllock") then   -- RMB press
      for j = 1, math.random(4, 5) do  -- first 4-5 bullets as rapid-fire
         PressMouseButton(1)
         Sleep(math.random(rapid_fire_delay, 2*rapid_fire_delay))
         ReleaseMouseButton(1)
         Sleep(math.random(rapid_fire_delay, 2*rapid_fire_delay))
         if not IsMouseButtonPressed(3) then return end  -- is RMB pressed?
      end
      PressMouseButton(1)
      LMB_Pressed = true
   elseif event == "MOUSE_BUTTON_RELEASED" and arg == 2 and LMB_Pressed then   -- RMB release
      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

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 double-click
            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. 将“Primary Click”绑定到 G8(从现在开始,使用按钮#8 而不是 LMB)
  2. 将“返回”绑定到 G1
  3. 设置脚本
Now you should have the following:
Primary Click = G8
Back          = G1 G4

鼠标按钮 #8 现在是“备用 LMB”,以防 LMB 无法正常工作。