Difference between revisions of "Key.pressed"

From MiniScript Wiki
Jump to navigation Jump to search
m
 
Line 17: Line 17:
 
("joystick 1 button 0", etc.).  With regard to joystick buttons,
 
("joystick 1 button 0", etc.).  With regard to joystick buttons,
 
if you don't specify a number (e.g. "joystick button 0"), then
 
if you don't specify a number (e.g. "joystick button 0"), then
it will detect a press of button 0 on *any* joystick.
+
it will detect a press of button 0 on ''any'' joystick.
 
See [[key.keyNames]] for all the possible names to use with this method.
 
See [[key.keyNames]] for all the possible names to use with this method.
  

Latest revision as of 03:33, 31 July 2020

key.pressed detects whether a specific key or button input is currently pressed.

See also: key.keyNames; key.axis

Arguments

Parameter Name Type Default Value Meaning
keyName string "space" key/button to press

Usage Notes

These include modifier keys (e.g. "left shift", "right alt") as well as mouse buttons (e.g. "mouse 0") and joystick/gamepad buttons ("joystick 1 button 0", etc.). With regard to joystick buttons, if you don't specify a number (e.g. "joystick button 0"), then it will detect a press of button 0 on any joystick. See key.keyNames for all the possible names to use with this method.

Example

while not key.pressed("left"); end while   // waits until left arrow pressed