In 2.25 gamepython what does sensor.isPositive actually dete

I’m using the version 2.25 for the gameengine. In my script I’m having trouble detecting weather a sensor is triggered. I’m using the sensor.isPositve method for sensors. the statement is
: if keysensor.isPositve:
print “The Key Sensor is Positve!”

Both a key sensor and an always sensor are connected to this python controller script (that contains the above statement).
When I run the script with both sensors connected, the always sensor continually triggers the script as expected, but what is unexpected is that it prints “The Key Sensor is Positive!” with every trigger, even when I’m not pressing the key to make it positive. I’ve tried every combination of True and False pulse modes, and in none of them can I successfully run the script and not have it print the positive key sensor message.(I have a seperate print message as an indicator that is independant of the conditional print statement, so in other words I can’t get the triggering of the script to only print the non conditional string. It always prints both strings, as if there is no way for keysensor.ispositive to return false. So I ask, what does the .isPositive method actually detect? So that I know what I’m looking for. Is it a positive pulse? Is it any pulse from the sensor? Is it positive until it actually recieves a false pulse? I would think that’d I’d have some clue at this point, with all the tests I’ve run. but none of my results make any sense. Does anybody have the 411? thanks -chris %|

if keysensor.isPositve():
        print "The Key Sensor is Positve!" 

Without the parenthesis, you’re just testing if the function object evaluates to true (which is always right, since a function object always evaluates to true). You have to call the function and use it’s return value instead.

Martin

AlRight! thanks, I’m used to actionscript so, yeah. So then I guess I just put the argument in the parentheses. But then, do I still have to reference what object the function belongs to? would it look like keysensor.isPositive(keysensor) ? I don’t know. At least I know what to look for now. thanks.

ispositive doesn’t take any arguments

it would be

keysensor.isPositive()

I didn’t know I left out the parenthesis up there. Which begs the question, why didn’t it work the first time around if I included parenthesis? I tried using sensor.isPositve(sensor) and it worked! I thought that was my solution, but now I try it with only the parenthesis and it worked. I bet I left out the parenthesis on the controller.getSensor() when I defined my sensor variable, and thats why it was giving me an error? I don’t remember getting specifically an attribute error. but minds aren/t very precise things sometimes. Anyways, it works now! Sorry for being such a ditz. Thanks guys.