Using the Animate Command as a Timer

Syntax

    animate [tag=tag] [mask OR nomask] object-name animation-name imagecount framecount framedelay [framelist]

Note: [ ] denotes optional arguments.

Simple timer usage

    create animate [tag=tag] [mask OR nomask] object-name animation-name imagecount framecount framedelay [framelist], astart; adone command...
    create animate [tag=tag] [mask OR nomask] object-name animation-name imagecount framecount framedelay [framelist]; activate astart; adone command...
    create animate [tag=tag] [mask OR nomask] object-name animation-name imagecount framecount framedelay [framelist]; bump astart; adone command...

Description

The animate command assigns a timed texture animation sequence to an object.

Use of the animate command as a timer for other events can be rather complex, and also involves the use of the astart command and the adone pseudotrigger. This page is intended to simplify the process of learning to use the animate command as a timer.

Separate help pages are available for information about the optional parameters:

If you wish to use the animate command as a timer only, without it applying any texture to any object, use the tag parameter with a value that does not match the internal tag value of any surface of the object that the animate command is applied to. For example, inserting tag=99 or tag=101 before the object-name with most objects will cause the animate not to apply any textures to the object, but the animation timer will still operate. If the object to which you are applying the animate command happens to have surfaces with the tag value you specify, then you will see textures applied to those surfaces.

Note: By default, textures are treated as not masked. If you wish to use the animate command with masked textures you must explicitly specify the mask option or the textures will be applied as unmasked.

The object-name argument specifies the name of the object to apply the animation to. This argument must be specified. If the animation is to be applied to this object, specify the keyword me as the object name. Object names are assigned via the name command.

The animation-name argument specifies the base name of the textures to be used in the animation. If you wish to keep your timer as simple as possible, use a single texture name that ends in the character 1 and simply leave the 1 off to produce the animation-name.

The imagecount argument specifies the total number of unique textures in the animation. If you want to keep your animation timer simple, use 1 for this value.

The framecount argument specifies the total number of frames in the animation sequence. Note this does not have to be the same as imagecount since a given image can be used more than once in an animation sequence. If you want to keep your animation timer simple, use 1 for this value.

The framedelay argument specifies the time in milliseconds between each frame of the animation. The value of this argument is very important for animation timers. Use a value of 1000 times the number of seconds you want your timer to last per frame.

The optional framelist argument allows you to specify the order of images to be displayed in the animation. Avoid using this argument if you wish to keep your animation timer simple.

The simplest animation timers use only a single texture in their animation, but if you are applying a single texture and not actually making use of the animate command's built in timer, then you should consider using the more efficient texture command instead.

Examples

    create animate me wow 1 1 325000, astart; adone visible target1 off

This action applies the wow1 texture to the control object and then, causes the object named target1 to turn invisible after a 325-second delay.

    create animate me fw 1 1 3000; activate astart; adone noise smart.wav

This action applies the fw1 texture and then, causes the zipped .wav sound file smart.zip to be downloaded from the object path, and the enclosed smart.wav sound to be played by a noise command 3 seconds after clicking the object this action is attached to.

    create animate me jk. 1 1 1500; bump astart; adone visible target1 on

This action applies the jk texture to the object it is placed on, and sets that object up as a control object. The object named target1 will then turn visible 1.5 seconds after the control object is bumped into. Of course, in order for this to work there needs to be an object in the area which has already been assigned the name target1 and already been made invisible.

    create animate tag=9 me wow 1 1 77000, astart; adone visible target1 off

This action applies the wow1 texture to the surfaces of this object which have the internal tag value of 9, if any such surfaces exist on the object. Then, it causes the object named target1 to turn invisible after a 77-second delay.

    create animate target2 fw 1 1 325000; activate astart target2

This action sets up a 325 second timer on all objects in the scene which have already been assigned the name target2 and then starts those timers when this object is clicked.

See the following help pages for additional information on the animate command: