XBox controller and python script

did you look at the test.blend in the extras folder? this shows how to use the scripts. i have full gamepad support. axis, buttons, and axis that act like buttons. buttons work like keyboard keys with the four states; inactive, tap, active, released. hats will be added next release.

the scripts are designed to make the keyboard and gamepad trigger the same events. in the keymap.py file, you can tell what button id on the gamepad to look for.

as far as i know, the sensor is behaving correctly, ill have to see if i can get it to trigger once, and not twice. try disabling tap, true, and false triggering. that works for always sensors.

I would like to try the test.blend, but it hangs and the game cannot be stopped using escape key. I’m not sure why this is happening.

I modified the test.blend text file from
if keys.BINDS[“ACTIVATE”].tap() == True: print(…
to:
if keys.BINDS[“ZOOM_IN”].tap() == True:
print(“button Pushed”)

Assuming i was looking for the joybutton 0, but got message KeyError: “ZOOM_IN”

i changed the exit key to pause/break. this way you can use the esc key for a pause menu. in the keymap.py, delete the line :

logic.setExitKey(events.PAUSEKEY)

as for the key error, could you double check that the keymap.py doesnt have any issues? if you cant figure it out, post the blend or the keymap.py in [CODE*] [/CODE*] tags (remove *).

BINDS is a dictionary, so make sure each line but the last has a comma after it.

dict = {
"KEY": "VALUE",
"ANOTHER": "VALUE"
}

# in the keymap, the "VALUE" is replaced with calling a class
dict= {"CLASS": class(arg=0) }

# then you can run a function in the class with dots
dict["CLASS"].run()

thanks for giving this a try, its helping me find weak points.