如何在罗技G HUB或其他Macro/Scripting软件中制作这个脚本?

How to make this script in Logitech G HUB or other Macro/Scripting software?

如何使这个脚本与这个宏一起工作:https://i.imgur.com/RLaXoW9.png?

EnablePrimaryMouseButtonEvents(true);
function OnEvent(event, arg)
if IsKeyLockOn("capslock")then
if IsMouseButtonPressed(1) then
repeat
MoveMouseRelative(0,-1)
Sleep(10)
until not IsMouseButtonPressed(1)
end 
end
end

是否也可以制作一个脚本,其中:

当按下鼠标左键时 - 它会 drag/snap 向上 crosshair/camera(目标上方几个像素)但同时,只有到达目标后武器才会 shot/fire那个像素?

  1. 解除你的宏与人民币的绑定。绑定标准“二次点击”到人民币
  2. 设置脚本:
function OnEvent(event, arg)
   if event == "PROFILE_ACTIVATED" then
      EnablePrimaryMouseButtonEvents(true)
   elseif event == "MOUSE_BUTTON_PRESSED" and arg == 2 and IsKeyLockOn"capslock" then  -- RMB pressed
      Sleep(50)
      PressKey"lshift"
      repeat
         MoveMouseRelative(0,-1)
         Sleep(10)
      until not IsMouseButtonPressed(3)  -- RMB released
      ReleaseKey"lshift"
   end
end

脚本#2

  1. 创建一个“备用 LMB”按钮。
    例如,如果您不使用 button#8,请将“Primary click”绑定到 Button#8。
    如果出现问题,您的 LMB 停止工作,您可以使用按钮 #8 代替 LMB。

  2. 设置脚本

function OnEvent(event, arg)
   if event == "PROFILE_ACTIVATED" then
      EnablePrimaryMouseButtonEvents(true)
   elseif event == "MOUSE_BUTTON_PRESSED" and arg == 1 then  -- LMB pressed
      if IsKeyLockOn"capslock" then
         if IsModifierPressed"shift" then
            -- Mouse movement when SHIFT is pressed
            for i = 1, 4 do  -- 4 steps.  Each step is 30ms delay and 5 pixels movement.  Total is 20 pixels
               MoveMouseRelative(0,-5)
               Sleep(30)
            end
         else
            -- Mouse movement when SHIFT is NOT pressed
            for i = 1, 4 do  -- 4 steps.  Each step is 30ms delay and 5 pixels movement.  Total is 20 pixels
               MoveMouseRelative(0,-5)
               Sleep(30)
            end
         end
      end
      PressMouseButton(1)
   elseif event == "MOUSE_BUTTON_RELEASED" and arg == 1 then  -- LMB released
      ReleaseMouseButton(1)
   end
end
  1. 取消绑定 LMB 的“主点击”(它将看起来像内部黑色的白色圆圈)。