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:
will be read as
objectA = 'actuator_name'
objectB = armature[objectA]
objectC = cont.actuators[objectB]
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"]
which is an alternative to your code
I hope it helps a bit