【问题标题】:Logitech Lua combining Rapid Fire with spray罗技 Lua 将 Rapid Fire 与喷雾相结合
【发布时间】:2020-10-13 21:46:49
【问题描述】:

所以基本上,这就是我的脚本目前的样子,它是一个快速射击宏并减少了枪的后坐力,但是由于某种原因我永远无法使用这个脚本进行喷涂,因为它非常慢,因为我猜它正在减少后坐力。我想知道我是否可以在没有任何后坐力的情况下射击 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

【问题讨论】:

  • 这个问题的代码看起来非常相似,答案对您有帮助吗? stackoverflow.com/questions/58121181/…
  • 不,先生,我认为其他脚本的作用是快速射击仅在按下 ctrl 键时激活。我想要做的是当我按住鼠标 2 时,它只会在按住时自动发射 4,5 颗子弹,而不是在快速射击后轻敲然后定期喷洒。
  • it’s a rapid fire macro and reduces the recoil of the guns - 不,您的脚本是纯粹的快速射击。它不会减少后坐力。您是在谈论其他脚本,而不是您发布的那个吗?
  • 是的,它是一个快速射击脚本,但是当你使用快速射击脚本来步枪时,根据你使用的枪,3,4 发子弹会直射,这就是为什么我即使它是快速射击脚本,也可以将其称为无后坐力脚本。我需要帮助的是强制脚本快速发射 4 发子弹,然后在脚本完成发射 4 发子弹后进行常规喷涂,基本上这个脚本只有 4 发子弹,然后进行常规喷涂....(猜想用 lua 是不可能的,但不知何故,我设法让它为奥斯卡宏工作,该死的老鼠。)
  • 所以,你按下鼠标右键来开启快速射击。而你现在只想在4发子弹后简单地释放RMB,尽管你仍然保持着RMB的物理压力?

标签: lua logitech logitech-gaming-software


【解决方案1】:
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. 将“主要点击”绑定到 G8(从现在开始,使用按钮#8 代替 LMB)
  2. 将“Back”绑定到 G1
  3. 设置脚本
Now you should have the following:
Primary Click = G8
Back          = G1 G4

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

【讨论】:

    猜你喜欢
    • 2021-08-14
    • 1970-01-01
    • 2021-05-15
    • 2021-03-29
    • 2011-02-23
    • 1970-01-01
    • 1970-01-01
    • 2021-04-12
    • 2021-08-13
    相关资源
    最近更新 更多