05-08-26

Mouse Inversion Lua Script

This Lua script inverts mouse movement using hardware input. It allows you to flip the horizontal and/or vertical mouse axes. The script uses the Rebind SDK to intercept and modify mouse input.

rebindlua scriptmouse inversionhardware inputinvert mouseluascript

Question

I need a mouse inversion script.

Rebind AI

lua
-- rebind: min_sdk=0.1.0 mouse_block=true
-- rebind: name=Mouse Inversion

local cfg = UI.Schema({
    enabled = UI.Toggle(true, { label = "Enable Mouse Inversion" }),
    invert_x = UI.Toggle(true, { label = "Invert Horizontal" }),
    invert_y = UI.Toggle(true, { label = "Invert Vertical" }),
})

function OnMove(dx, dy)
    if not cfg.enabled then
        return true
    end

    local new_dx = cfg.invert_x and -dx or dx
    local new_dy = cfg.invert_y and -dy or dy

    HID.Move(new_dx, new_dy)
    return false
end

How it works:

This script inverts your mouse movement by negating the delta values. With mouse_block=true in the modeline, the script can block and modify mouse input before it reaches your PC.

  • enabled: Toggle the entire feature on/off
  • invert_x: Flip horizontal movement (left becomes right, right becomes left)
  • invert_y: Flip vertical movement (up becomes down, down becomes up)

By default both axes are inverted. You can disable one axis if you only want partial inversion (e.g., just flip up/down for a specific game).

The script captures the original movement, negates it, and sends the inverted version to your PC instead.

Learn more: