button
button
gets/sets the button that activates sensor.
Type: integer
0 = 1st button
1 = 2nd button
etc.
Note:
If Joystick sensor 'All/All
Button Events' toggle button is selected, this variable is ignored.
Sample
Code
################ Get button
# get controller
controller = GameLogic.getCurrentController()
# get sensor attached to controller named FlightStick
sen = controller.sensors["FlightStick"]
# get button that activates sensor
but = sen.button
################ Set button
# get controller
controller = GameLogic.getCurrentController()
# get sensor attached to controller named FlightStick
sen = controller.sensors["FlightStick"]
# set button that activates sensor
sen.button = 0
|