Using python program to fire weapon

I’m working in an FPS setup. I’ve got a script to fire the currently equipped weapon - however it seems that the python controller interprets both pressing the mouse button and letting go of it as positive pulses. Therefore one click of the mouse causes the weapon to fire twice - once right when you click and again when you let go of the button.

after searching through one of the GameLogic reference pages I found a python method that I believe should allow me to solve this problem - however I cannot find any reasonable documentation of how to use the method.

The method is “getButtonStatus().” The reason I cannot get it to work is that getButtonStatus takes one integer argument - though the referencen never explains this I’m pretty sure that integer is supposed to correspond to the mouse button whose status you want to get.

I tried passing one, assuming that this was, if not the number corresponding to left-click, then at least the number corresponding to ONE of the mouse buttons. However python just gave me an error saying that this was invalid input, that this button does not exist. I tried 0 as well - same thing.

I suppose I could go through and just try every number until I get one that works - but this just doesn’t sound very practical or fun. Can anybody tell me which integers correspond to mouse button clicks?

Here is the error I get when using “0” (which, according to a source I found, should correspond to the “first” mouse button. Apparently they are wrong though?

ValueError: sensor.getButtonStatus(int): Mouse Sensor, invalid button specified!

if sensor.isPositive() seems to be the answer.