The script flow and catching exceptions

Official forum for open source FreePIE discussion and development.
Post Reply
Jabberwock
Cross Eyed!
Posts: 197
Joined: Mon Mar 02, 2015 3:58 pm

The script flow and catching exceptions

Post by Jabberwock »

I am testing the following script:

try:
gamepad = joystick["Gamepad F310 (Controller)"]
xoutput[0].A = gamepad.getDown(0)
xoutput[0].B = gamepad.getDown(1)

except Exception:
xoutput[0].A = 0


The exception is for the cases when the controller is not connected (yet), e.g. for games which select a controller pretty randomly, so it is useful that only the virtual one is detectable at the game start. The exception works in that it does not throw an error when the script is executed without the stick. However, when I do connect it later, the script is not working.

I was under impression that the script is executed afresh at each tick... so the exception should go away. Or is the problem that FreePIE itself does not rediscover controllers when they are connected while the script is running?
Post Reply

Return to “FreePIE”