Message in python bug - solved by battery

Hey all,

I use this:

if own.timer=>2:
gameLogic.sendMessage(“subject”, “to object”,)

print “send”
The object that recieves it has a python script attached to it with the line:

print “recieved”.

The problem is that he now types:

send
recieved
recieved
send
recieved
recieved

Anyone knows a easy solution to this?

There was a similar issue to do with keyboard sensors triggering twice recently. If the case is the same here then it’s normal behaviour, the sensor gets the message and sends one positive pulse triggering the attached controller, it then sends a negative pulse after the message is received which also triggers the controller - hence the double print. You can fix it by getting the script only to trigger on a positive pules:



if messageSensor.positive: 
# Checks to see if the message sensors is sending a positive pulse
print 'received' 


Hope this helps!

Cool thanks a lot! ^^ it worked