Lua:mouse event

From Cheat Engine
Revision as of 00:00, 5 December 2025 by Leunsel (talk | contribs) (Added CodeBox Template.)
Jump to navigation Jump to search

<> Lua API Reference

function mouse_event(Flags, [dx, dy, Data, ExtraInfo]) : void

Calls the Windows API mouse_event directly for advanced mouse control. See the MSDN documentation for detailed information about the parameters.

Function Parameters

Parameter Type Description
Flags Integer Specifies various aspects of mouse motion and button clicks.
dx Integer (optional) The absolute x-coordinate or relative motion in pixels.
dy Integer (optional) The absolute y-coordinate or relative motion in pixels.
Data Integer (optional) Additional data, e.g., amount of wheel movement.
ExtraInfo Integer (optional) Application-defined extra information.

Returns

void — This function does not return a value.

Example

setMousePos(659, 573)
mouse_event(MOUSEEVENTF_LEFTDOWN)
sleep(20)
mouse_event(MOUSEEVENTF_LEFTUP)

Main Pages

Core Lua documentation entry points

Lua
Script Engine

Mouse Related Functions

Keyboard Related Functions

Global Hotkey Related Functions