# How to play action actuator logic brick via python

I want to know how to play(send true pulse) to an action actuator via script (logic brick with all the settings) since playAction doesn't have animation property which I need.

You can use python to activate the Action actuator with this script. You will need three logic bricks: A sensor (to trigger it all), the python controller, and the action actuator.

cont = bge.logic.getCurrentController()

act = cont.actuators["Action"] # the name of the Action actuator

if cont.sensors["Keyboard"].positive: # trigger when buton pressed

#Set all the properties you want
act.action = "CubeAction"
act.frameStart = 1
act.frameEnd = 30
act.priority = 0

cont.activate(act) # start the actuator


You can set as many or as few of the settings that you need with python or in the logic brick, however the python will overrule any duplicate settings. Here is a list of all the settings for the Action actuator.
Do note the the two minimum setting you need are the action name, and frame end.

• c.activate(act) was the only thing what i needed but thx for all – terrio Mar 8 '15 at 7:49
• Your code refers to the sensor and actuator explicitly by name. Could they be looked up by the "in" and "out" connectors of the controller brick? – Passiday Aug 28 '16 at 21:48
• @Passiday no, you have to specify the logic bricks by name, or id. – David Aug 28 '16 at 23:20