BindJoystickButton

From Spheriki

Jump to: navigation, search

Sets up scripts to run when a joystick button is pressed or released.


Contents

Usage

BindJoystickButton(joystick, button, on_button_down, on_button_up);
  • joystick number, non-negative. Which joystick has the button you wish to bind.
  • button number, non-negative. The button on the joystick to bind scripts to.
  • on_button_down string, containing the JavaScript code to run when the button is pressed down.
  • on_button_up string, containing the JavaScript code to run when the button is released.


Examples

To set a variable run to the first button on the first joystick:

BindJoystickButton(0, 0, "run = true;", "run = false;");


Notes

  • Most scripts in Sphere are checked when the engine starts up. However, the scripts in these strings will not be checked until they are encountered.


See also

Personal tools