Difference between revisions of "Mouse.button"

From MiniScript Wiki
Jump to navigation Jump to search
(Created page with "In Mini Micro, the mouse.button function returns whether a given mouse button is currently pressed. === Arguments === {| class="wikitable" |- ! Parameter Name !! Default...")
 
Line 1: Line 1:
In [[Mini Micro]], the mouse.button function returns whether a given mouse button is currently pressed.
+
In [[Mini Micro]], the [[mouse]].button function returns whether a given mouse button is currently pressed.
  
 
=== Arguments ===
 
=== Arguments ===

Revision as of 14:35, 8 March 2020

In Mini Micro, the mouse.button function returns whether a given mouse button is currently pressed.

Arguments

Parameter Name Default Value Meaning
which 0 which button (0 through 6) to check

Usage Notes

The main mouse button is button 0, and this is also the default. So in typical cases, no argument to mouse.button is needed.

This method returns 1 (true) while the button is pressed, and 0 (false) when it is not.

Example

This example continuously displays the value of all mouse buttons. Run this, then click various buttons on your mouse to test. (Note that most mice have only three buttons, so the rest will always return 0.)

while not key.pressed("escape")
	text.row = 10
	print "mouse.button:    " + mouse.button
	for b in range(1,6)
		print "mouse.button(" + b + "): " + mouse.button(b)
	end for
end while
key.clear  // (clear escape key from key buffer)