Difference between revisions of "Mouse Control"
m (Changed protection level for "Mouse Control" ([edit=sysop] (indefinite) [move=sysop] (indefinite))) |
|||
(13 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
− | == | + | == 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. | + | Sets the mouse's screen position to (x,y), where x and y are integers. Coordinates are absolute. See [[Mouse_Control#mouseMove|mouseMove()]] to specify relative coordinates. |
− | = | + | '''Example''' |
+ | <source lang="lua"> | ||
+ | mouseSet(100, 200); -- This will move the mouse to (100,200) | ||
+ | </source> | ||
− | |||
+ | == mouseMove == | ||
+ | '''mouseMove(x, y)''' | ||
− | == mouseLClick() | + | Moves the mouse (x,y) pixels, where x and y are integers. Coordinates are relative. See [[Mouse_Control#mouseSet|mouseSet()]] to specify absolute coordinates. |
+ | |||
+ | |||
+ | '''Example''' | ||
+ | <source lang="lua"> | ||
+ | mouseMove(5, 10); -- This will move the mouse right 5 pixels and down 10 | ||
+ | </source> | ||
+ | |||
+ | |||
+ | == mouseLClick == | ||
+ | '''mouseLClick()''' | ||
Clicks the left mouse button. | Clicks the left mouse button. | ||
− | == mouseMClick() | + | '''Example''' |
+ | <source lang="lua"> | ||
+ | mouseLClick(); -- The left mouse button will be clicked | ||
+ | </source> | ||
+ | |||
+ | |||
+ | == mouseMClick == | ||
+ | '''mouseMClick()''' | ||
Clicks the middle (or wheel) mouse button. | Clicks the middle (or wheel) mouse button. | ||
− | == mouseRClick() | + | '''Example''' |
+ | <source lang="lua"> | ||
+ | mouseMClick(); -- The middle/wheel mouse button will be clicked | ||
+ | </source> | ||
+ | |||
+ | |||
+ | == mouseRClick == | ||
+ | '''mouseRClick()''' | ||
Clicks the right mouse button. | Clicks the right mouse button. | ||
− | == mouseLHold() == | + | '''Example''' |
+ | <source lang="lua"> | ||
+ | mouseRClick(); -- The right mouse button will be clicked | ||
+ | </source> | ||
+ | |||
+ | |||
+ | == mouseLHold == | ||
+ | '''mouseLHold()''' | ||
+ | |||
+ | Holds down the left mouse button until a left click or left release. Use [[Mouse_Control#mouseLRelease|mouseLRelease()]] to release. | ||
+ | |||
+ | |||
+ | '''Example''' | ||
+ | <source lang="lua"> | ||
+ | mouseLHold(); -- The left mouse button will be held down. Click or use mouseLRelease to release | ||
+ | </source> | ||
+ | |||
+ | |||
+ | == mouseMHold == | ||
+ | '''mouseMHold()''' | ||
+ | |||
+ | Holds down the middle/wheel mouse button until a middle/wheel click or middle/wheel button release. Use [[Mouse_Control#mouseMRelease|mouseMRelease()]] to release. | ||
+ | |||
+ | |||
+ | '''Example''' | ||
+ | <source lang="lua"> | ||
+ | mouseLHold(); -- The middle/wheel mouse button will be held down. Click or use mouseMRelease to release | ||
+ | </source> | ||
+ | |||
+ | |||
+ | == mouseRHold == | ||
+ | '''mouseRHold()''' | ||
+ | |||
+ | Holds down the right mouse button until a right click or right release. Use [[Mouse_Control#mouseRRelease|mouseRRelease()]] to release. | ||
+ | |||
+ | |||
+ | '''Example''' | ||
+ | <source lang="lua"> | ||
+ | mouseRHold(); -- The right mouse button will be held down. Click or use mouseRRelease to release | ||
+ | </source> | ||
+ | |||
+ | |||
+ | == mouseLRelease == | ||
+ | '''mouseLRelease()''' | ||
+ | |||
+ | Releases the left mouse button, if held down. | ||
+ | |||
+ | |||
+ | '''Example''' | ||
+ | <source lang="lua"> | ||
+ | mouseLRelease(); -- The left mouse button is no longer being held | ||
+ | </source> | ||
+ | |||
+ | |||
+ | == mouseMRelease == | ||
+ | '''mouseMRelease()''' | ||
+ | |||
+ | Releases the middle/wheel mouse button, if held down. | ||
+ | |||
+ | |||
+ | '''Example''' | ||
+ | <source lang="lua"> | ||
+ | mouseRRelease(); -- The right mouse button is no longer being held | ||
+ | </source> | ||
+ | |||
+ | |||
+ | == mouseRRelease == | ||
+ | '''mouseRRelease()''' | ||
+ | |||
+ | Releases the right mouse button, if held down. | ||
+ | |||
+ | |||
+ | '''Example''' | ||
+ | <source lang="lua"> | ||
+ | mouseRRelease(); -- The right mouse button is no longer being held | ||
+ | </source> | ||
+ | |||
+ | |||
+ | == 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''' | ||
+ | <source lang="lua"> | ||
+ | mouseWheelMove(100); -- The mouse wheel will be scrolled up 100 units. | ||
+ | </source> | ||
+ | |||
+ | |||
+ | == mouseGetPos == | ||
+ | '''x,y mouseGetPos()''' | ||
+ | |||
+ | Retrieve the screen coordinates of the mouse. Returns two integers: x and y. | ||
− | |||
+ | '''Example''' | ||
+ | <source lang="lua"> | ||
+ | x,y = mouseGetPos(); | ||
+ | printf("mouse_x: %d, mouse_y: %d", x, y); -- display the coordinates of the mouse | ||
+ | </source> | ||
− | |||
− | + | == mouseSetDelay == | |
+ | '''mouseSetDelay()''' | ||
+ | Similar to [[Keyboard_Control#keyboardSetDelay|keyboardSetDelay()]], this function sets the delay (in miliseconds) between click and release for functions like [[Mouse_Control#mouseLClick|mouseLClick()]] and [[Mouse_Control#mouseRClick|mouseRClick()]]. | ||
− | |||
− | + | '''Example''' | |
+ | <source lang="lua"> | ||
+ | mouseSetDelay(100); -- The mouse delay is now 100ms | ||
+ | </source> |
Latest revision as of 22:14, 22 July 2011
Contents
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