Hi, i was making a script that includes a property on it. At the moment of call the property, blender script has given me a error, that says:
animations Python script error - object bruno skelleton, controller ‘Python’: File “animations”, line 72, in <module> NameError: name o is not defined …
and the part of the script is this:
if o[“frame”]==172.0:
Cube.enableDynamics()
how is the correct way to call an object property on an if sequence in python? Do i have to define the property on my vars?? if so, how can i define it?
i have a Keybord sensor with allKeys activated connected to the python controller and also connected with an Action actuators, where i play all the animations i define upthere …
I don’t know what’s wrong with this script.
You haven’t defined “o”. You can do that like this:
...
co = g.getCurrentController()
scene = g.getCurrentScene()
o = co.owner
...
You should use conventional terms for the names of certain variables such as the controller and owner.
(cont = logic.getCurrentController, own = cont.owner/obj = cont.owner). Most people use those terms, though it is not necessary.
instead of “g = bge.logic”, should be “from bge import logic as g”