Mouse

The Mouse file contains all mouse movement and clicking functions.

The source for this file can be found here.

var mouseSpeed

Adjustable global mouse speed variable. Default set to 20.

Example

mouseSpeed := 50;

fastClick

procedure fastClick(button: integer);

Quickly click the mouse with any button.

Note

  • by Flight

Example:

fastClick(MOUSE_LEFT);

mouse

procedure mouse(pnt: TPoint; button: integer; mmType: integer = MOUSE_HUMAN); overload;

Moves the mouse to ‘pnt’ using specified ‘mmType’ then clicks the mouse ‘button’.

Note

  • by NCDS & Flight

Example:

mouse(point, mouse_Left, MOUSE_ACCURATE);

mouse() overload;

procedure mouse(pnt: TPoint); overload;

Moves the mouse to ‘pnt’.

Note

  • by NCDS & Flight

Example:

mouse(point(50, 50));

mouse overload

procedure mouse(x, y, randX, randY, button: integer = MOUSE_MOVE);

Moves the mouse to x, y, coords adding random randX and randY onto x and y. The ‘button’ parameter is set to MOUSE_MOVE by default.

Note

  • by Olly

Example:

mouse(100, 100, 5, 5, MOUSE_LEFT);
mouse(100, 100, 5, 5);

moveMouse overload

procedure moveMouse(p: TPoint);

An overloaded MoveMouse which takes a TPoint. Useful for when you want to teleport the mouse.

Note

  • by Thomas

Example:

moveMouse(p)

missMouse

procedure missMouse(pnt: TPoint; correct: boolean = true);

Moves the mouse, but initially misses the target point (miss area determined by dist & speed) then if correct = true it will correct itself.

Note

  • by Flight

Example:

missMouse(point);

dragMouse

procedure dragMouse(dest: TPoint);

Clicks MOUSE_LEFT at current position and drags to dest(ination).

Note

  • by NCDS & Naum

Example:

dragMouse(point);

mouseScroll()

procedure mouseScroll(pnt: TPoint; scrolls: integer; down: boolean = true);

Moves the mouse to “pnt”, and scrolls the mouse wheel in a human way. Will scroll the number of times declared by “scrolls”. Will scroll up or down depending on the ‘down’ parameter (set to true by default).

Note

  • by Coh3n
  • Last Updated: 23 July 2013 by Coh3n

Example:

mouseScroll(p, 50);
mouseScroll(p, 10, false);

mouseBox

procedure mouseBox(b: TBox; button: integer = MOUSE_MOVE);

Moves the mouse somewhere inside the box ‘b’, with more change of being around the middle of the box. The ‘button’ is set to MOUSE_MOVE by default.

Note

  • by Coh3n
  • Last Updated: 17 March 2013 by Coh3n

Example:

mouseBox(b, MOUSE_LEFT);

mouseOval

procedure mouseOval(cx, cy, rx, ry, mouseAction: Integer = MOUSE_MOVE);
Clicks a random point within an oval shape.
  • cx, cy: The center point of the oval.
  • rx, ry: X and Y radius of the oval.
  • mouseAction: the action of the mouse. Default set to MOUSE_MOVE;

Note

  • by mixster
  • Last Updated: 16 March 2013 by Coh3n

Example:

mouseOval(100, 100, 50, 30);

mouseCircle

procedure mouseCircle(MidX, MidY, Radius, mouseAction: Integer = MOUSE_MOVE);

Same as mouseOval, but within a circle instead.

Note

  • by mixster
  • Last Updated: 21 March 2012 by Coh3n

Example:

mouseCircle(50, 50, 25);

didClick

function didClick(Red: Boolean; Time: Integer = 1000): boolean;

Left clicks the current mouse position and looks for the colored X. Times out after ‘Time’. The ‘Time’ is set to 1000 by default.

Note

  • by Rasta Magician, Narcle, Coh3n
  • Last Updated: 14 Jan 2014 by The Mayor

Example:

if didClick(true) then
  writeLn('Clicked an object!');

multiClick

function multiClick(p: TPoint; chance, maxClicks: integer): boolean;

Will simulate “spam” clicking on the point ‘p’. It will click random amount of times between 1 and ‘maxClicks’. It will always click once, then has a percent ‘chance’ of clicking again. Will not exceed ‘maxClicks’.

Note

  • Author: Coh3n
  • Last Updated: 16 March 2013 by Coh3n

Example:

if isMouseOverText('Tree') then
  multiClick(p, 35, 5);

getRealMousePos

procedure getRealMousePos(var x, y : Integer);

Retrives the position of the real (not smart) mouse relative to the desktop client. Can be used to create an interactive GUI drawn on smart.

Note

  • Author: Zyt3x

Example:

getRealMousePos(x, y);

getRealMousePos

procedure getRealMousePos(var P : TPoint); overload;

An averload of the above method, which takes a TPoint instead

Note

  • Author: Zyt3x

Example:

getRealMousePos(P);
if isPointInBox(P, GUIclickBox) then
  writeLn('You pressed the button!);