http://www2.gamecore.ca/docs/scripting-reference/classes/Object/SetMotionVariableFloatThis is the kind of thing that you would likely want to be updating on a regular basis, in your object's DynamicsAdvance or AnimAdvance functions. You can see an example with setting the animation speed in the player script:
Vector linearVelocity = base.GetLinearVelocity();
Vector groundVelocity = linearVelocity;
groundVelocity.y = 0;
if (!dead)
{
object.SetMotionVariableFloat( "Velocity", groundVelocity.GetLength());
object.PlayAnim( "Move");
}
In this case we are setting two different types of motion variables, the MotionScalarVar and the MotionSelectVar.
From the soldier.opr in the FPS Multiplayer:
AddMotion IdleMotion
MotionAnim Idle
MotionSelectVar Velocity
MotionSelectMax 0.0
MotionFadeInTime 0.2
AddMotion WalkMotion
MotionAnim Walk
MotionScalarVar Velocity
MotionScalarRef 1.3
MotionSelectVar Velocity
MotionSelectMin 0.0
MotionSelectMax 3.0
MotionFadeInTime 0.2
AddMotion RunMotion
MotionAnim Run
MotionScalarVar Velocity
MotionScalarRef 3.0
MotionSelectVar Velocity
MotionSelectMin 3.0
MotionFadeInTime 0.2
AddMotion Move
MotionChild IdleMotion
MotionChild WalkMotion
MotionChild RunMotion
What this does is setup the various animations used by the 'move' motion and then defines a variable called 'Velocity' which we then use from script to control both the speed of the animations' being played (via the ScalarVar) and also which animation is being played (via the SelectVar).
By simply calling 'object.PlayAnim("Move");' and setting this Velocity variable, the engine will automatically switch between the idle, walk and run animations for the soldier and also control the speed of the animation accordingly so that the motions blend better.