Skip to content


The mouseWheel event fires when the mouse wheel is used, providing a delta value.

--- @param e mouseWheelEventData
local function mouseWheelCallback(e)
event.register(tes3.event.mouseWheel, mouseWheelCallback)


An event can be claimed by setting e.claim to true, or by returning false from the callback. Claiming the event prevents any lower priority callbacks from being called.

Event Data⚓︎

  • delta (number): Read-only. The direction and strength of the mouse wheel movement. The value is positive for scrolling up, negative otherwise. This magnitude is hardware dependent.
  • isAltDown (number): Read-only. True if alt is held.
  • isControlDown (number): Read-only. True if control is held.
  • isShiftDown (number): Read-only. True if either shift key is held.
  • isSuperDown (number): Read-only. True if super (Windows key) is held.


Example: Filtering out key presses that aren't equal to the bound key combination

-- An example of a simple configuration setup
local defaultConfig = {
    ---@type mwseKeyMouseCombo
    combo = {
        -- Alt + Left mouse button
        mouseButton = 0,
        isAltDown = true,
        isControlDown = false,
        isShiftDown = false,
local config = mwse.loadConfig("myModConfig", defaultConfig)

local function registerModConfig()
    local template = mwse.mcm.createTemplate({ name = "Test Mod" })

    local page = template:createSideBarPage({ label = "Settings" })

        label = "My combo",
        description = "This combo does...",
        allowMouse = true,
        variable = mwse.mcm.createTableVariable({
            id = "combo",
            table = config
event.register(tes3.event.modConfigReady, registerModConfig)

--- @param e keyDownEventData|mouseButtonDownEventData|mouseWheelEventData
local function sayHi(e)
    if not tes3.isKeyEqual({ expected = config.combo, actual = e }) then
        -- Nothing to do if the pressed combination isn't equal to our expected combination.

    -- Now do our logic

event.register(tes3.event.keyDown, sayHi)
event.register(tes3.event.mouseButtonDown, sayHi)
event.register(tes3.event.mouseWheel, sayHi)