29
  Action commands
  Timer * at * At VRT
 

From the tutorial park in the world AWSchool (35N 30E) , you can teleport to "Bach Zhaa's Astart Adone advanced tutorials" ( 32N 104E), where you can view the difference between the animate and timer commnad .

Or you can teleport to the "create timer" (40N 50E) area. Here you can read that the timer command was introduced with AW version 5.1 and was meant to make simplier animations instead of using the rather complicated animate command . With the timer command, you don't need to specify several numbers for the textures , you only need to specify the duration. With the timer command , you have the "at tm"-trigger instead of having the more complicated "astart/adone"-trigger. More info on the wiki pages :

http://wiki.activeworlds.com/index.php?title=Timer
http://wiki.activeworlds.com/index.php?title=At (=trigger)
In the animation classes (see item 27), we saw already some examples with the timer command : domino animation, horse animation and dolfin animation.
These examples were a bit complicated, because there are several objects involved in order to make the animation. Each time the the name command was used. Now we will see a few examples of "timer" and "at" commands upon 1 single object.

 

********** Color Animation **********
This timer command will change the sign object into a different color : every 3,33 seconds, 5.55 seconds and 7.77 seconds. If you would use durations like 3333, 6666 and 9999 , then you would barely see an animation, because in that case, the colors will change at the same moment. The "at" trigger is followed by "tm". The "-1" indicates an eternal loop.
sign3.rwx
create timer ABC "-1"; at tm ABC 3333 loop, color red; at tm ABC 5555 loop, color yellow; at tm ABC 7777 loop, color green
 
********** Move Animation **********
This timer command will move the object constantly upwards every 5.5 seconds and forward every 7.7 seconds, this means that after a while both moves could happen at the almost the same moment.
bed.rwx
create timer ABCD "-1"; at tm ABCD 5555 loop, move 0 2 0; at tm ABCD 7777 loop, move 3 0 0
 
***** Noise Animation ******
This timer command lasts 20 seconds : after 1 second you will hear the first noise, after 5 seconds the second noise, after 10 seconds the animation will repeat a 2nd time (loop=2).
sign3.rwx
create timer ABC2 10000 loop=2; at tm ABC2 1000, noise boom1.wav ;at tm ABC2 5000, noise brain.wav
**** Scheduled animation ****
In this case you can do scheduled events based on VRT time. There is no timer command involved, only the "at" trigger. In the first example, the animation will start at 10:03 VRT time.
sign3.rwx
at VRT 10:03:00, noise brain.wav
In the second example , the animation will repeat every minute. You can only choose between : : 01add hh mm 01.
at VRT ::01, noise brain.wav
at VRT hh:mm:01, noise brain.wav
Here the animation will start 1 second after every VRT hour.
at VRT :00:01 , noise brain.wav
at VRT hh:00:01 , noise brain.wav
This way you could make for example a cuckoo clock. Or you can make working traffic lights, or even a railway system with moving barriers, all this without having to use a bot.

**** Traffic Lights Animation **********
For most of the animation applications however, you will need more than 1 object and you will have to apply the name command for it. Now we will see 4 ways of how to make traffic lights. The examples can be found in Bach Zhaa's Tutorial Area in AWSchool 27N 121E. We start with the traffic lights box :
speak3b.rwx
create scale 1.1 1.5,color b
now we add the 3 lights : xckw1.rwx , and there are 2 sets for each : the traffic lights turning red and those turning green. The animation is on the poles.
In example 1 all the objects are pre-colored and the commands turns them visible on and visible no. (using the animate command)
xckw1.rwx
create name lt1r,color red,visible no ------- create name lt2r,color red,visible no
create name lt1y,color yellow,visible no ------- create name lt2y,color yellow,visible no
create name lt1g,color green,visible no ----- create name lt2g,color green,visible no
pole1m.rwx
create name tl1,animate me . 1 1 0;adone visible lt2y no,visible lt2r on,visible lt1g on,visible lt1r no
create name tl1,animate me . 1 1 5000;adone visible lt1g no,visible lt1y on
create name tl1,animate me . 1 1 6500;adone visible lt1y no,visible lt1r on,visible lt2g on,visible lt2r no
create name tl1,animate me . 1 1 11500;adone visible lt2g no,visible lt2y on
create name tl1,animate me . 1 1 13000;adone astart tl1
If you use the timer command , you only need 2 poles, but with all animations in 1 command , as you can use several "at" triggers in 1 command line.:
create timer tm1 13000 loop=-1 stop ;at tm tm1 1,visible tt2y no,visible tt2r on,visible tt1g on,visible tt1r no
;at tm tm1 5000,visible tt1g no,visible tt1y on ;at tm tm1 6500,visible tt1y no,visible tt1r on,visible tt2g on,visible tt2r no
at tm tm1 11500,visible tt2g no,visible tt2y on
In example 2 the objects are colored from black to the appropriate color and back again. (using the animate command)
xckw1.rwx
create scale 1.1,name 21r,color b ----- create scale 1.1,name 22r,color b
create scale 1.1,name 21y,color b ----- create scale 1.1,name 22y,color b
create scale 1.1,name 21g,color b ----- create scale 1.1,name 22g,color b
pole1m.rwx
create name tl2,animate me . 1 1 0;adone color red name=21r,color b name=21y,color green name=22g,color b name=22r
create name tl2,animate me . 1 1 5000;adone color yellow name=22y,color b name=22g
create name tl2,animate me . 1 1 6500;adone color red name=22r,color b name=22y,color green name=21g,color b name=21r
create name tl2,animate me . 1 1 11500;adone color yellow name=21y,color b name=21g
create name tl2,animate me . 1 1 13000;adone astart tl2
In example 3 the astart name is seperated and each is astarting the next in the series using the visible on/no command. (using the animate command)
xckw1.rwx
create scale 1.1 1.5,color b ----- create name lt4r,color red,visible no
create name lt3y,color yellow,visible no ----- create name lt4y,color yellow,visible no
create name lt3g,color green,visible no ----- create name lt4g,color green,visible no
pole1m.rwx
create name 131,animate me . 1 1 0;adone visible lt4y no,visible lt4r on,visible lt3g on,visible lt3r no,astart 132
create name 132,animate me . 1 1 5000;adone visible lt3g no,visible lt3y on,astart 133
create name 133,animate me . 1 1 1500;adone visible lt3y no,visible lt3r on,visible lt4g on,visible lt4r no,astart 134
create name 134,animate me . 1 1 5000;adone visible lt4g no,visible lt4y on,astart 135
create name 135,animate me . 1 1 1500;adone astart 131
In this example the timer/tm name is seperated and each is initiating the next in the series using the visible on/no command. (using the timer command)
create timer 1st 1 stop;at tm 1st 1, visible tt4y no,visible tt4r on,visible tt3g on,visible tt3r no,timer 2nd reset
create timer 2nd 5000 stop;at tm 2nd 5000, visible tt3g no,visible tt3y on,timer 3rd reset
create timer 3rd 1500 stop;at tm 3rd 1500, visible tt3y no,visible tt3r on,visible tt4g on,visible tt4r no,timer 4th reset
create timer 4th 5000 stop;at tm 4th 5000, visible tt4g no,visible tt4y on,timer 5th reset
create timer 5th 1500 stop;at tm 5th 1500, timer 1st reset
In example 4 (not in the tutorial area) you can make traffic lights with the scheduled animation with the "at VRT" time command. With this command, you can repeat the animation every minute. We use the same traffic lights commands as in example 1 , only the commands on the poles are different .In this animation the traffic lights are also both red for a short while. So you can say that is the best and easiest way of making traffic lights.
pole1m.rwx
at VRT ::01, visible lt1g on, visible lt1r off , visible lt2r on
at VRT ::24, visible lt1g off , visible lt1y on , visible lt2r on
at VRT ::27, visible lt1y off , visible lt1r on , visible lt2r on
at VRT ::31, visible lt1r on , visible lt2g on , visible lt2r off
at VRT ::54, visible lt1r on , visible lt2g off , visible lt2y on
at VRT ::57, visible lt1r on , visible lt2y off , visible lt2r on