Hello!
I am stuck in python trying to send a message once, but i cant find the right way to do it.
if own[‘me’] = ‘1’:
send.Message(‘hello’) # I want this to be sent only once.
Thanks/
Hello!
I am stuck in python trying to send a message once, but i cant find the right way to do it.
if own[‘me’] = ‘1’:
send.Message(‘hello’) # I want this to be sent only once.
Thanks/
Just ball parking here, but (simply) set a variable or a counter, that counts how many times it is send?
if times_send = 0, then…
if times_send = 1, then…
or something like this:
if own[‘me’] = ‘1’ && message_send = ‘0’:
send.Message(‘hello’) # I want this to be sent only once.
message_send =+1
ain’t skilled enough for the specific syntax though.
But am sure you can figure it out. 
For python noobs like me:
“if Sensor.positive == True:”
delivers my intention once and once only.
if not 'sent' in obj:
obj['sent'] = 1
send.Message('hello') # You could do this, or you could access the object directly via Python
Not sure of what ‘send’ is (I never use the Message actuator), but I assume you want a message actuator. Also, you could access objects via Python if you want to send a message to just a specific object. Finally, you could check to see if a variable exists, and if not, create it (like above; this way, you can run the code to see), or you could run the script with an Always sensor without True pulse triggering.
Thanks! I will try it when I reach home,anyway I can’t use a simple always sensor because that piece if code is a part of another big one.