Mouse Control

From SolarStrike wiki
Jump to: navigation, search

mouseSet

mouseSet(x, y)

Sets the mouse's screen position to (x,y), where x and y are integers. Coordinates are absolute. See mouseMove() to specify relative coordinates.


Example

mouseSet(100, 200); -- This will move the mouse to (100,200)


mouseMove

mouseMove(x, y)

Moves the mouse (x,y) pixels, where x and y are integers. Coordinates are relative. See mouseSet() to specify absolute coordinates.


Example

mouseMove(5, 10); -- This will move the mouse right 5 pixels and down 10


mouseLClick

mouseLClick()

Clicks the left mouse button.


Example

mouseLClick(); -- The left mouse button will be clicked


mouseMClick

mouseMClick()

Clicks the middle (or wheel) mouse button.


Example

mouseMClick(); -- The middle/wheel mouse button will be clicked


mouseRClick

mouseRClick()

Clicks the right mouse button.


Example

mouseRClick(); -- The right mouse button will be clicked


mouseLHold

mouseLHold()

Holds down the left mouse button until a left click or left release. Use mouseLRelease() to release.


Example

mouseLHold(); -- The left mouse button will be held down. Click or use mouseLRelease to release


mouseMHold

mouseMHold()

Holds down the middle/wheel mouse button until a middle/wheel click or middle/wheel button release. Use mouseMRelease() to release.


Example

mouseLHold(); -- The middle/wheel mouse button will be held down. Click or use mouseMRelease to release


mouseRHold

mouseRHold()

Holds down the right mouse button until a right click or right release. Use mouseRRelease() to release.


Example

mouseRHold(); -- The right mouse button will be held down. Click or use mouseRRelease to release


mouseLRelease

mouseLRelease()

Releases the left mouse button, if held down.


Example

mouseLRelease(); -- The left mouse button is no longer being held


mouseMRelease

mouseMRelease()

Releases the middle/wheel mouse button, if held down.


Example

mouseRRelease(); -- The right mouse button is no longer being held


mouseRRelease

mouseRRelease()

Releases the right mouse button, if held down.


Example

mouseRRelease(); -- The right mouse button is no longer being held


mouseWheelMove

mouseWheelMove()

Move the mouse wheel up or down by 'amount'. 'amount' can be either positive (up) or negative (down). An 'amount' of 100 is roughly one 'tick' of the wheel.


Example

mouseWheelMove(100); -- The mouse wheel will be scrolled up 100 units.


mouseGetPos

x,y mouseGetPos()

Retrieve the screen coordinates of the mouse. Returns two integers: x and y.


Example

x,y = mouseGetPos();
printf("mouse_x: %d, mouse_y: %d", x, y); -- display the coordinates of the mouse


mouseSetDelay

mouseSetDelay()

Similar to keyboardSetDelay(), this function sets the delay (in miliseconds) between click and release for functions like mouseLClick() and mouseRClick().


Example

mouseSetDelay(100); -- The mouse delay is now 100ms