ID of a controller to check
0 | Default Controller |
1 to 4 | Normal Controller |
・For details on the controller ID, refer to the help for the CONTROLLER function.
ID of a button to check
Correspondence between button ID and button is as follows
・Correspondence between button ID and button is different for each operation style.
Button ID | Full, dual-controller grip | held vertically | held horizontally |
---|---|---|---|
#B_RUP | X Button | Up Button | Up Button |
#B_RDOWN | B Button | Down Button | Down Button |
#B_RLEFT | Y Button | Left Button | Left Button |
#B_RRIGHT | A Button | Right Button | Right Button |
#B_LUP | Up Button | ||
#B_LDOWN | Down Button | ||
#B_LLEFT | Left Button | ||
#B_LRIGHT | Right Button | ||
#B_L1 #B_SL | L | SL | SL |
#B_R1 #B_SR | R | SR | SR |
#B_L2 #B_S1 | ZL | L or R | L or R |
#B_R2 #B_S2 | ZR | ZL or ZR | ZL or ZR |
#B_LSTICK | Press the L Stick | Press the Stick | Press the Stick |
#B_RSTICK | Press the R Stick | ||
#B_RANY | Any of A/B/X/Y Buttons | ||
#B_LANY | Any of Up/Down/Left/Right Buttons | ||
#B_ANY | Any Buttons other than Press the Stick |
・The top, bottom, left and right of the directional buttons are the button positions relative to the direction with the controller. The vertically held “up” is the horizontally held “left”.
Type of condition you want to know
・0, if not specified.
0 | Button is pressed |
1 | The moment the button is pressed (with BREPEAT support) |
2 | The moment the button is pressed (no BREPEAT support) |
3 | The moment the button is released |
1 if the specified button satisfies the specified function ID conditions, 0 otherwise
・If you only want to get the status of one button, see the help for another BUTTON function.
ID of controller to check
0 | Default Controller |
1 to 4 | Normal Controller |
・For details on the controller ID, refer to the help for the CONTROLLER function.
If button ID is specified to -1, all button states will be collected together.
・If only controller ID is specified, -1 is specified.
Type of condition you want to know
・0, if not specified.
0 | Button is pressed |
1 | The moment the button is pressed (with BREPEAT support) |
2 | The moment the button is pressed (no BREPEAT support) |
3 | The moment the button is released |
The button state of the specified controller is returned with each bit.
To check if the button is pressed, you can write the following program
'To create a value with the bit corresponding to the button turned ON, shift 1 to the left (<<) by the button ID 'For example, if you want to check if #B_RLEFT is pressed BTNBIT_RLEFT = 1 << #B_RLEFT 'Once the bit value is created, the result of the BUTTON function and the AND are calculated. If the result is other than 0, it is pressed. IF (BUTTON(0) AND BTNBIT_RLEFT) !=0 THEN PRINT "Left Button"