[fixed]keyboard sensor Problem

Ok, basically when I push the space bar down it executes the script, then when i release it, the script is executed again.

here’s a little blend to show you:
Press_Space.blend (130 KB) - press space once then check the console.

So how can I get around this?

Sensors will send a positive and negative event, if you only want to check for positive events do…
if controller.sensors[“MySensor”].positive: # … do stuff …

i fixed it with this little script:

contr = GameLogic.getCurrentController()

for sensor in contr.sensors:
if not sensor.positive: break

rest of the script

print “abc123”