You can read the position of up to two joysticks and their buttons. The readjoystick command reads the x, y, and z of an installed joystick (proper drivers must also be installed) and also their buttons. The variables are visible everywhere because they are global.

Usage:

readjoystick 1

The command above reads the current status of joystick 1 and places the values into these global variables:

Joy1x, Joy1y, Joy1z, Joy1button1, Joy1button2

readjoystick 2

The command above reads the current status of joystick 2 and places the values into these global variables: