Difference between revisions of "Lua:mouse event"

From Cheat Engine
Jump to navigation Jump to search
m (Added CodeBox Template.)
m (Syntax Highlighting.)
 
Line 36: Line 36:
  
 
===Example===
 
===Example===
<pre>
+
<syntaxhighlight lang="lua" line>
 
setMousePos(659, 573)
 
setMousePos(659, 573)
 
mouse_event(MOUSEEVENTF_LEFTDOWN)
 
mouse_event(MOUSEEVENTF_LEFTDOWN)
 
sleep(20)
 
sleep(20)
 
mouse_event(MOUSEEVENTF_LEFTUP)
 
mouse_event(MOUSEEVENTF_LEFTUP)
</pre>
+
</syntaxhighlight>
  
 
{{LuaSeeAlso}}
 
{{LuaSeeAlso}}
  
 
{{KeyboardMouse}}
 
{{KeyboardMouse}}

Latest revision as of 19:32, 25 June 2026

<> 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[edit]

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[edit]

void — This function does not return a value.

Example[edit]

1 setMousePos(659, 573)
2 mouse_event(MOUSEEVENTF_LEFTDOWN)
3 sleep(20)
4 mouse_event(MOUSEEVENTF_LEFTUP)

Main Pages

Core Lua documentation entry points

Lua
Script Engine

Mouse Related Functions

Keyboard Related Functions

Global Hotkey Related Functions