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...")
 
(Add link to howto)
 
(One intermediate revision by one other user not shown)
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 ===
Line 27: Line 27:
 
end while
 
end while
 
key.clear  // (clear escape key from key buffer)</ms>
 
key.clear  // (clear escape key from key buffer)</ms>
 +
 +
== See also ==
 +
 +
* [[How to detect single mouse clicks]]
  
 
[[Category:Mini Micro]]
 
[[Category:Mini Micro]]

Latest revision as of 15:16, 20 November 2021

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)

See also