MOUSECLICK

This command will return an integer value if a mouse button is pressed.

  Syntax
Return Integer=MOUSECLICK()
  Returns

The left button is assigned a value of 1. The right button is assigned a value of 2. Buttons three and four are assigned values of 4 and 8 respectively. When more than one button is pressed, the value of the buttons are added to produce a combined value you can check for.

  Description

The integer return value will depend on which mouse button has been pressed. A mouse can have up to four buttons, and each one can be detected using this command. Each button is assigned a value. The left button is assigned a value of 1. The right button is assigned a value of 2. Buttons three and four are assigned values of 4 and 8 respectively. When more than one button is pressed, the value of the buttons are added to produce a combined value you can check for.

  Example Code
do
cls
print "mousemovex "+str$(mousemovex())
print "mousemovey "+str$(mousemovey())
print "mousemovez "+str$(mousemovez())
print "mouse position x "+str$(mousex())
print "mouse position y "+str$(mousey())
print "mouse position z "+str$(mousez())
print "Press 1 to hide mouse"
print "Press 2 to show mouse"
print "Press 3 to change mouse image"
print "Press 4 to change mouse image back"
print "Press 5 to position mouse to top of screen"
if scancode()=2 then hide mouse
if scancode()=3 then show mouse
if scancode()=4 then change mouse 1
if scancode()=5 then change mouse 0
if scancode()=6 then position mouse mousex(),0
if mouseclick()=1 then print "left mouse button"
if mouseclick()=2 then print "right mouse button"
loop
end
  See also

INPUT Commands Menu
Index