cont.activate != working

cont.activate(cont.actuators[armature[‘actuator_name’]])

This line is not working.

actuator_name is a string
it is on the armature

there is an actuator with the same name as the string

but the animation freezes on the first frame

this has never happened before.

first I was having problems with .playaction so i just changed my setup to only rely on cont.activate. now that does not work either. Has anyone had any problems with cont.activate animation not progressing?

I have tried a situation where it is constantly triggering, and also a situation where it only triggers .activate once.

both do not work

even when i do a simple:

if message sensor positive:
cont.activate

it does not work

so break it down:


cont = logic.getCurrentController()
own = cont.owner
scene = own.scene
armature = scene.getObjects['armature']
actuator = armature.actuators['actuator_name']

armature.activate(actuator)

thought it was like that

what cotax said…

youre syntax is wrong…Should show an error

Please use code tags when posting code.

Please check the BGE API according to:

As cotax already wrote it is better to isolate single statements, especially when the code does not work as expected. Check what is input against the allowed input.

lets play compiler:


cont.activate(cont.actuators[armature['actuator_name']])

will be read as


objectA = 'actuator_name'
objectB = armature[objectA] 
objectC = cont.actuators[objectB] 
cont.activate(objectC)

I hope you see this code has several problems:
“armature” and “cont” are not defined. This will result in errors.

Assuming (and you can be sure a compiler never assumes) that
-> “armature” is a KX_GameObject and
-> “cont” is a SCA_PythonController

you can conclude

  • objectA is assigned to a string
  • objectB is assigned to the value of a property of a KX_GameObject. The name of the property is “actuator_name”. The type will be determined at runtime.
  • objectC will be a SCA_IActuator if objectC is the name (string) of a connected actuator
  • the cont will be called with objectC as argument

You can print all objects to console to check if the content matches your expectations.


print(objectA, objectB, objectC)

cont.activate(objectC) will have effects only when objectC is

  • a connected actuator or
  • a string with the name of a connected actuator.

So you could write:


actuatorName = armature["actuator_name"]
controller.activate(actuatorName)

which is an alternative to your code

I hope it helps a bit

bit tired atm. but doesn’t this:

actuatorName = armature[“actuator_name”]

grab a property actuator_name from the armature not the actuator it self?