launching an action from script

Hello guyssssssssssssss!! this be me again :stuck_out_tongue:

this time i got htis problem:
i have a “library” of actions (animations) on an object (mesh). What i need to do is to play them from a script.

Ill give u the big picture (very)

We are doing a simulation of a lab rat; and i have a log that records where the rat moves and what conduct is it doing at any time (standing, grooming, cleaning… etc). The log looks at something like this:


second     position        conduct
1               x3,y3,z0      A
2               x5,y3,z0      A
3               x7,y3,z0      B
4               x4,y3,z0      B
5               x1,y3,z0      C
...

And i got a piece of script that creates an IPO curve for hte rat that moves the entire body though scene. But i also need to animate the conducts!!! D:

so i got a premade library with actions that if i could incorporate someone those animations into the IPO curve that moves the rat, i would be happy! :smiley:

so any ideas?

My idea … forget the IPO. These are predefined paths.

Move it with the motion actuator. This allows combinations of different motion types (rotation, translation).

Use actions (with the action actuator) for the real animation (standing, walking etc.) on place.

Here you have the API for this actuator.

but how could i reproduce an action from a script?

have one (or more) action actuators.
Access the actuator(s) from the script:


actionActuator = cont.actuators["actutorsname"]

now you can set what ever you want:


actionActuator.action = "myAction"
actionActuator.frameEnd = 100
...
cont.activate(actionActuator)