・Depending on the setting operation style, the types of controllers that can be connected, the expected Joy-Con holding method, the types of buttons and Stick that can be acquired, and the controller functions that can be used vary.
・The operation result on the connection confirmation display can be confirmed with the RESULT function (1: Success, -1: Cancel).
・Calls from subprograms are ignored.
Specify the maximum number of controllers you want to connect
・The range of values that can be specified varies depending on the operation style.
Full | 1 to 2 |
dual-controller grip | 1 to 2 |
held horizontally | 2 to 4 |
held vertically | 2 to 4 |
Operation style to be set: 0 to 3
Number | Style Name | Available Controllers |
---|---|---|
0 | Full | handheld mode, dual-controller grip, Pro Controller |
1 | dual-controller grip | dual-controller grip |
2 | held horizontally | Joy-Con (L)/(R) held horizontally, Pro Controller |
3 | held vertically | Joy-Con (L)/(R) held vertically |
Specify 1 if you want to use motion sensors (accelerometer, gyroscope) or 0 if you do not use it.
・0, if not specified.
Specify 1 if you want to use IR Motion Camera, 0 if you do not use it.
・0, if not specified.
・When using IR Motion Camera, the operation style must be 1 (dual-controller grip).
Specify whether to always display the controller connection display
・If 1 is specified, the controller connection display will be displayed.
・If 0 is specified, the controller connection display is displayed only when the setting is changed.
・0, if not specified.
・If only 0 is specified, the controller operation style is reset to the startup state.
・Same as specifying XCTRLSTYLE 1,0,0,0.
・The operation result on the connection confirmation display can be confirmed with the RESULT function (1: Success, -1: Cancel).
・Calls from subprograms are ignored.
Specify only numeric zero
・An error occurs if a different value is specified.
Maximum number of controllers that can be connected
OperationStyle
0 | Full |
1 | dual-controller grip |
2 | held horizontally |
3 | held vertically |
0 | Default Controller |
1 to 4 | Normal Controller |
・The normal controller ID corresponds to the number of player LED on the connected controllers.
・If the handheld mode controller can be used, the ID is always 1.
・The default controller combines the inputs of all connected controllers and always treats them as inputs equivalent to the handheld mode controller regardless of the currently set operation style.
・When using controller IDs 1 to 4, it is strongly recommended to set the operation style you want to use with the XCTRLSTYLE command in advance.
0 | Not Connected |
1 | handheld mode controller |
2 | Pro Controller |
3 | dual-controller grip |
4 | Joy-Con (L) |
5 | Joy-Con (R) |
0 | Default Controller |
1 to 4 | Normal Controller |
・The normal controller ID corresponds to the number of player LED on the connected controllers.
・If the handheld mode controller can be used, the ID is always 1.
・The default controller combines the inputs of all connected controllers and always treats them as inputs equivalent to the handheld mode controller regardless of the currently set operation style.
・When using controller IDs 1 to 4, it is strongly recommended to set the operation style you want to use with the XCTRLSTYLE command in advance.
0 | Not Connected |
1 | handheld mode controller |
2 | Pro Controller |
3 | dual-controller grip |
4 | Joy-Con (L) |
5 | Joy-Con (R) |
Returns the controller color in two color codes, the main color and the sub color
・The obtained color code can be used as the color code for other drawing commands.
・If the controller is not connected, the main and sub will return black.
When dual-controller grip or handheld mode controller are used, the left and right controller colors can be acquired separately.
・Black is returned to the right main color and the right sub color when it is held horizontally and held vertically.
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"
・This affects the result when 1 is specified for the function ID of the BUTTON function.
・Affects all connected controllers.
ID of the button which wants to set repeat speed
・For details on the button ID, refer to the help for the BUTTON function.
Frame count from when the button starts to be pressed until repeat starts
Frame count from the occurrence of a repeat until the next repeat occurs
ID of the button which wants to obtain repeat speed
・For details on the button ID, refer to the help for the BUTTON function.
Frame count from when the button starts to be pressed until repeat starts
Frame count from the occurrence of a repeat until the next repeat occurs
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.
0 | L Stick |
1 | R Stick |
・0, if not specified.
・Specifying 1 when there is only one Stick does not cause an error, and 0 is returned for both X and Y.
Stick tilt information
・Left <-> Right 1.0<>1.0 in the horizontal direction (X).
・Up <-> Down 1.0<>1.0 in the vertical direction (Y).
・When no operation is performed, 0 is returned for both X and Y.
・If the motion sensor is not enabled in XCTRLSTYLE, normal values will not be returned.
ID of a controller you want to check: 1 to 4
・ControllerID 0 cannot be specified.
・For details on the controller ID, refer to the help for the CONTROLLER function.
ID of sensor to check: 0 to 1
・A meaningful value with ID 1 is returned only when dual-controller grip is used.
・0, if not specified.
Accelerometer value
・The unit is acceleration of gravity.
・X is the left/right directional button (right button direction is positive)
・Y is the up/down directional button (down button direction is positive)
・Z is perpendicular to the controller surface (upward is positive)
・If the motion sensor is not enabled in XCTRLSTYLE, normal values will not be returned.
ID of the controller you want to check: 1 to 4
・ControllerID 0 cannot be specified.
・For details on the controller ID, refer to the help for the CONTROLLER function.
ID of sensor to check: 0 to 1
・ID 1 is valid only when dual-controller grip is used.
・0, if not specified.
Angular velocity of gyroscope around each axis
・The unit is radian/second.
・X is pitch.
・Y is roll.
・Z is yaw.
・The direction in which the right screw rotates in each positive direction is a positive value.
・If the motion sensor is not enabled in XCTRLSTYLE, 0 will be returned to all.
・If you move the controller violently or continue to use it for a long time, errors will accumulate and the correct value will not be returned. So, it is necessary to reset the angle by calling the GYROSYNC command at the required timing.
ID of the controller you want to check: 1 to 4
・ControllerID 0 cannot be specified.
・For details on the controller ID, refer to the help for the CONTROLLER function.
ID of sensor to check: 0 to 1
・ID 1 is valid only when dual-controller grip is used.
・0, if not specified.
Gyroscope angle around each axis
・The unit is radian.
・X is pitch.
・Y is a roll.
・Z is yaw.
・The direction in which the right screw rotates in each positive direction is a positive value.
・The controller posture immediately after calling the command is X:0,Y:0,Z:0.
・A maximum time of 1V count is required until the actual reset is performed after using the GYROSYNC command.
Controller ID to be reset: 1 to 4
・Controller ID 0 cannot be specified.
・For details on the controller ID, refer to the help for the CONTROLLER function.
ID of sensor to be reset: 0 to 1
・When it's other than dual-controller grip, even if 1 is specified, it is ignored.
・0, if not specified.
・Calls from subprograms are ignored.
Controller ID to be vibrated: 1 to 4
・ControllerID 0 cannot be specified.
・For details on the controller ID, refer to the help for the CONTROLLER function.
Specify left and right controller to vibrate
0 | Left |
1 | Right |
・If not specified, both left and right vibrate.
・In case of held vertically and held horizontally, even if 1 is specified, it is ignored.
Preset vibration pattern number: 0 to 62
・Vibration stops when 0 is specified.
VIBRATE 1,40 VIBRATE 1,0,1:VIBRATE 1,1,3
・Calls from subprograms are ignored.
Controller ID to be vibrated: 1 to 4
・ControllerID 0 cannot be specified.
・For details on the controller ID, refer to the help for the CONTROLLER function.
Specify left and right controller to vibrate
0 | Left |
1 | Right |
・If not specified, both left and right vibrate.
・In case of held vertically and held horizontally, even if 1 is specified, it is ignored.
Vibration frequency (Hz)
・Vibration stops when 0 is specified.
Vibration amplitude: -128.0 to 127.0
・Vibration stops when 0 is specified.
Vibration frequency (Hz)
・Vibration stops when 0 is specified.
Vibration amplitude: -128.0 to 127.0
・Vibration stops when 0 is specified.
VIBRATE 1,440,127,220,64
Controller ID for acquiring vibration status: 1 to 4
・ControllerID 0 cannot be specified.
・For details on the controller ID, refer to the help for the CONTROLLER function.
Specify whether to acquire vibration status of left or right
0 | Left |
1 | Right |
・If not specified, the combined value of the left and right states is returned.
・In the case of held vertically and held horizontally, if 1 is specified, 0 is always returned.
・If it is vibrating, it returns the vibration pattern number. If frequency/amplitude is directly specified, it returns 65535.
・0 when it's not vibrating.
・If the left / right designation is not specified except for held vertically or held horizontally, RightStateValue*65536+LeftStateValue is returned.
・If left and right designation is not specified for held vertically and held horizontally, only the left state value is returned.
PRINT VIBRATE(1,0)
・Calls from subprograms are ignored.
VIBRATE
・The TOUCH function does not return a valid value in TV mode.
With multi-touch, you can specify up to 0, 1, 2, 3 ... and 9 in the order of the touch start point.
・0, if not specified.
If 0 is specified, the touch coordinates are converted to the coordinates on the BASIC display where the touch coordinates are displayed, and touches outside the display are treated as untouched actions.
If 1 is specified, the touch coordinates on the entire LCD display are acquired regardless of the BASIC display.
・0, if not specified.
Frame count from start of touch to present
・0 is returned when it's not touched.
Coordinates when touched
・If it is not touched, a meaningless value is returned.
Touch area when touched
・If it is not touched, a meaningless value is returned.
If 0 is specified, mouse coordinates are converted to the coordinates of the BASIC display on which they are displayed.
If 1 is specified, the mouse coordinates of the entire LCD display are acquired regardless of the BASIC display.
Current mouse coordinates
Current wheel value
Mouse coordinates to set
If 0 is specified, X and Y are handled as BASIC display coordinates.
If 1 is specified, X and Y are handled as coordinates on the entire LCD display.
・0, if not specified.
・If you want to get the status of only one button, refer to another MBUTTON help page.
Mouse button state is returned bit by bit
ID of a button you want to check
0 | Left Button |
1 | Right Button |
2 | Center Button |
3 | Button 4 |
4 | Button 5 |
Type of condition you want to know
0 | Button is pressed |
1 | (Not Available) |
2 | The moment the button is pressed |
3 | The moment the button is released |
・0, if not specified.
1 if the specified button satisfies the specified function ID conditions, 0 otherwise
・It is necessary to turn on the IR usage flag beforehand in XCTRLSTYLE.
・Calls from subprograms are ignored.
ID of the controller using the IR Motion Camera: 1 to 2
・For details on the controller ID, refer to the help for the CONTROLLER function.
Specify the IR Motion Camera recognition method
0 | Clustering Mode |
1 | Shooting Mode |
2 | Moment Mode |
・Clustering mode recognizes bright areas as rectangles. A maximum of 16 areas can be recognized simultaneously.
・In the shooting mode, images captured by the IR Motion Camera are acquired as images.
・Data taken in the shooting mode can be displayed in IRSPRITE. Data cannot be retrieved into a BASIC program.
・Display capture is prohibited while the shooting mode is activated.
・In the moment mode, the imaging range is divided into 8x6 small areas, and each piece of recognition information is acquired.
・It is necessary to turn on the IR usage flag beforehand in XCTRLSTYLE.
・Calls from subprograms are ignored.
ID of the controller using the IR Motion Camera: 1 to 2
・For details on the controller ID, refer to the help for the CONTROLLER function.
Specify 0 for the clustering mode
Specify IR Motion Camera lighting
0 | All (Far + Near) |
1 | For Long Range Only |
2 | For Short Range Only |
3 | Lighting Off |
・0, if not specified.
IR Motion Camera shooting gain: 1 to 16
・2 is the default.
IR Motion Camera exposure time: 7 to 600
・200 is the default.
Minimum area (number of pixels) that can be recognized as a cluster: 0 to 76800
・3 is the default.
Maximum area (number of pixels) that can be recognized as a cluster: 0 to 76800
・76800 is the default.
Minimum brightness to recognize as a cluster: 0 to 255
・150 is the default.
・It is necessary to turn on the IR usage flag beforehand in XCTRLSTYLE.
・Data taken in the shooting mode can be displayed in IRSPRITE. Data cannot be retrieved into a BASIC program.
・Display capture is prohibited while the shooting mode is activated.
・Calls from subprograms are ignored.
ID of controller using IR Motion Camera: 1
・You can specify only 1 in the shooting mode.
・For details on the controller ID, refer to the help for the CONTROLLER function.
Always specify 1 for the shooting mode
Specify IR Camera lighting
0 | All (Far + Near) |
1 | For Long Range Only |
2 | For Short Range Only |
3 | Lighting Off |
・0, if not specified.
IR Motion Camera shooting gain: 1 to 16
・8 is the default.
IR Motion Camera exposure time: 7 to 600
・300 is the default.
Specify the size of the shot image
0 | 320×240 |
1 | 160×120 |
2 | 80×60 |
3 | 40×30 |
4 | 20×15 |
・The larger the image size, the longer it takes to transfer. 320×240 for a minimum of 4 seconds, 4 times faster for each smaller size.
・2 is the default.
・It is necessary to turn on the IR usage flag beforehand in XCTRLSTYLE.
・Calls from subprograms are ignored.
ID of the controller using the IR Motion Camera: 1 to 2
・For details on the controller ID, refer to the help for the CONTROLLER function.
Specify 2 for the moment mode
Specify IR Motion Camera lighting
0 | All (Far + Near) |
1 | For Long Range Only |
2 | For Short Range Only |
3 | Lighting Off |
・0, if not specified.
IR Motion Camera shooting gain: 1 to 16
・8 is the default.
IR Camera exposure time: 7 to 600
・300 is the default.
・Calls from subprograms are ignored.
ID of the controller that stops using the IR Motion Camera: 1 to 2
・For details on the controller ID, refer to the help for the CONTROLLER function.
ID of the controller that acquires the status of the IR Motion Camera: 1 to 2
・For details on the controller ID, refer to the help for the CONTROLLER function.
IR Camera status
0 | Not in Use |
1 | Stopped |
2 | Starting Clustering |
3 | Starting Shooting Mode |
4 | Starting Moment Mode |
・It is necessary to start using the IR Motion Camera with IRSTART.
ID of the controller that reads the recognition result of the IR Motion Camera: 1 to 2
・For details on the controller ID, refer to the help for the CONTROLLER function.
A number that increases by 1 each time new data is read
・If the same number is acquired continuously, it indicates that new data has not been received yet.
Noise level during recognition
・A value between 0 and 2 is returned. The smaller the value, the less noise and the more accurate the value is.
The number of data contained in the data array
・In the clustering mode, the number of recognized clusters is displayed. The array contains information for each cluster.
・It's always 48 in the moment mode. The array contains information of each block obtained by dividing the imaging area into 8×6.
An array containing the read recognition results
・A 2D array with a width of 8.
・The height contains a meaningful value from 0 to the number of data -1.
・The coordinate range is X: (0 to 320) Y: (0 to 240).
・The data format for the clustering mode is as follows.
0 | Cluster X Coordinate |
1 | Cluster Y Coordinate |
2 | Cluster Width |
3 | Cluster Height |
4 | Number of Pixels in Cluster |
5 | Cluster Barycentric Coordinates X |
6 | Cluster Barycentric Coordinates Y |
7 | Average Cluster Brightness |
・Data format in the moment mode is as follows.
0 | Average Block Brightness |
1 | Block Barycentric Coordinates X |
2 | Block Barycentric Coordinates Y |
・The captured image continues to be reflected in the specified sprite in real time.
・Sprites created with IRSPRITE can be handled in the same way as normal sprites. However, if SPPAGE is specified, it cannot be restored.
・Shooting data in the shooting mode cannot be acquired as BASIC data.
・Calls from subprograms are ignored.
ID of controller with IR Motion Camera linked to sprite: 1
・Only 1 can be specified in IRSPRITE.
・For details on the controller ID, refer to the help for the CONTROLLER function.
Sprite ID to be linked to the shot image: 0 to 4095
・Return values are all zero when the USB keyboard is not connected.
USB Usage ID of the key you want to check: 0 to 255
The type of condition you want to know.
0 | Key is pressed |
1 | Cannot be used (if specified, zero is returned as the result) |
2 | The moment the key is pressed |
3 | The moment the key is released |
・0, if not specified.
1 if the key is specified by the function ID, 0 if not
Returns modifier key press information in bits
bit0 | Windows Key |
bit1 | Shift Key |
bit2 | Ctrl Key |
bit3 | Alt Key |