Skip to content

Instantly share code, notes, and snippets.

@zenojunior
Created November 14, 2025 20:24
Show Gist options
  • Select an option

  • Save zenojunior/9932a3bd1e62ad204d7e549d7c320399 to your computer and use it in GitHub Desktop.

Select an option

Save zenojunior/9932a3bd1e62ad204d7e549d7c320399 to your computer and use it in GitHub Desktop.
Move Defibrillator - ARC Raiders
-- ============================================================================
-- MACRO: Move Defibrillator - ARC Raiders
-- ============================================================================
--
-- FUNCTION: Automatically moves defibrillator from secure pocket to quick access
-- GAME: ARC Raiders
-- ACTIVATION: Mouse scroll button (button 3)
--
-- SUMMARY:
-- This macro performs a smooth drag of the defibrillator from the secure pocket
-- (bottom right of inventory) to the quick access slot (top right), allowing
-- quick use during combat.
--
-- AUTHOR: github.com/zenojunior
-- Logitech G HUB virtual coordinate system (0 to 65535 for both axes)
-- ============================================================================
-- Maximum resolution of Logitech G HUB virtual coordinates
local VIRTUAL_RESOLUTION = 65535
-- Positions in virtual coordinates (0-65535)
local START_X = math.floor(VIRTUAL_RESOLUTION * 0.80)
local START_Y = math.floor(VIRTUAL_RESOLUTION * 0.70)
local END_X = math.floor(VIRTUAL_RESOLUTION * 0.80)
local END_Y = math.floor(VIRTUAL_RESOLUTION * 0.40)
local DRAG_SPEED = 100
local MOVE_DELAY = 0
local TRIGGER_KEY = 3
function OnEvent(event, arg)
if event == "MOUSE_BUTTON_PRESSED" and arg == TRIGGER_KEY then
MoveDefibrillatorToQuickAccess()
end
end
function MoveDefibrillatorToQuickAccess()
OutputLogMessage("Moving defibrillator to quick access...")
PressKey("tab")
Sleep(10)
ReleaseKey("tab")
Sleep(100)
MoveMouseToVirtual(START_X + 1, START_Y + 1)
Sleep(15)
MoveMouseToVirtual(START_X, START_Y)
Sleep(2)
PressMouseButton(1)
SmoothDrag(START_X, START_Y, END_X, END_Y)
ReleaseMouseButton(1)
PressKey("tab")
Sleep(10)
ReleaseKey("tab")
Sleep(100)
AutoEquipDefibrillator()
OutputLogMessage("Defibrillator moved and equipped successfully!")
end
function AutoEquipDefibrillator()
OutputLogMessage("Equipping defibrillator...")
PressKey("q")
Sleep(300)
PressAndReleaseKey("6")
Sleep(50)
ReleaseKey("q")
OutputLogMessage("Defibrillator equipped!")
end
function SmoothDrag(fromX, fromY, toX, toY)
local deltaX = toX - fromX
local deltaY = toY - fromY
local distance = math.sqrt(deltaX * deltaX + deltaY * deltaY)
local steps = math.floor(distance / DRAG_SPEED)
steps = math.max(3, math.min(steps, 15))
for i = 0, steps do
local progress = i / steps
local currentX = math.floor(fromX + (deltaX * progress))
local currentY = math.floor(fromY + (deltaY * progress))
MoveMouseToVirtual(currentX, currentY)
Sleep(MOVE_DELAY)
end
MoveMouseToVirtual(toX, toY)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment