MOUSE

Syntax

MOUSE

Explanation

MOUSE outputs the current mouse coordinates in a list of two numbers representing the x coordinate and the y coordinate. If no mouse is present, the coordinates are always [0 0].

See also BUTTON? and .MOUSEON.

Example

The following procedure uses the mouse to move the turtle. When the left mouse button is held down, the turtle will draw as it moves. Press the right mouse button to end the procedure.

TO CHASE


 * LABEL "L


 * IF BUTTON? 1 THEN PD ELSE PU


 * SETXY MOUSE


 * IF NOT BUTTON? 2 THEN GO "L

END