Propertys Addition Error

Im using 2.42a as most of us would be.

The problem is that when i want a property to increase by +1 it will go up by +2

This must be an error/bug with the program, or is it just me??

Any help is appreciated.

A demo .blend is here -http://z02.zupload.com/download.php?file=getfile&filepath=6450

ahh this is a really erritating but as has been answered on this forum the message actuator sends two messages every time it is activated.

err to fix the problem try using something besides the message actuator
or just add 0.5 to the property(it will have to be a float).

I haven’t looked at your blend file but you can copy properties with the copy setting in the property actuator, its what i usually use. (Dont know if its less efficient though).

It seems that the message sensor fires two positive pulses instead of one positive and one negative. fireside figured out a workaround for the this bug using Python. Apparently only the first pulse carries the message body if you give it one, so give your messages meaningless body text, then use the Python code

if messageSensor.body:

followed by your instructions (where “messageSensor” is the name of your sensor). At least, I think that’s the right code. If it doesn’t work, try searching up fireside’s original post on the matter.

Actually it’s :


if messageSensor.getBodies():
    owner.Text = owner.Text + 1

I would have posted, but I didn’t think Ad-edge is into Python yet. The advantage to this method is that if it gets fixed in a later version, it will still work. The other solutions will require fixing later. I’ve got a lot of messages being fired in my game, so it’s important I don’t have to do a major bug fix like that. Just one more reason to start learning Python. Sending dynamic information in the body can also be extremely useful. Suppose there are different things that add a different amount to the health, whatever. Send the amount in the body and convert it to an integer. One simple subject message can deliver hundreds of different amounts of numbers or text messages, and one script can parse it and make decisions on it. Your program will be much easier to understand because everything leads to one script where the logic flow is written instead of wires going all over the place. In many cases you won’t even need to send messages, you can just get the object and change the property, but I’ve found messages to still be useful.

Hey, thanks for that. I did do a serch on it before i posted but couldnt find anything on it.

And yeh, ive only just started on python, so ill give a few things a try.

Im sure ill work it out now. :slight_smile:

Thanks

Sweet, i just got it.

It all works fine now so thanks everyone! :wink: