Script Help

ok. I want to set the state of “Armature.006” and “Telekinesis Sensor” and also delete a property called “Telekinesis Sensor” from “Telekinesis Sensor” in the same script. The script seems to work just fine for setting the new state mask but when i add the code for deleting the property “telekinesis Sensor” it seems to then only delet the property but not change the state. any help? heres the script

import GameLogic
scene = GameLogic.getCurrentScene()
PowersOrigin = scene.objects[‘OBArmature.006’]
TelekinesisSensor = scene.objects[‘OBTelekinesis Sensor’]
Telekinesissensor.state = 2
PowersOrigin.state = 1
del TelekinesisSensor[“Telekinesis Sensor”]

Nothing appears to be wrong with that script. Are there any errors in the console? How is the script being executed?

no errors in the console. but i worked around it with another script that does the exact same thing but it goes about it in a different way. The new script that works id’s the Telekinetic object via its property and then deletes the property itself…hmmm

From design perspective an object should not change the state of another one.

Reason: When analyzing the logic it is really hard to find where the state change comes from.

Other solutions:
Notify the other object with messages.
Notify the other object with properties.

Example: Looking at the above code I can’t tell what it is supposed to do. It looks like it changes states. But there is no information what that could mean.

Just my thoughts

Monster is pretty much right. I called the script from the object that held the property. However it only did it when I used the second script I made (where it id’s the object via its property, instead of identifying the object directly via
obj = [‘OB’]