How to use Astart Astop Animation (AAA).

 

Concept – AAA works by an animation on a time, paired with the “adone” trigger.  This means you can set up an animated texture to be one second long, and when that animation is done (adone – animation done), you can set off any command as if it were a “create” trigger, such as visibility and solid changes.

 

 

Learning the basics - moving a rock with AAA

 

 

If you wanted a rock to move from one place to another, AAA was the solution.  Below are the steps.

 

  1. Build each frame of the rock animation.  Let’s use 4 frames for this example.  All the rocks in the frame would need to be named.  So the first rock could have a name such as r1, and the next rock would be r2, and so on.  You’ll probably want all the rocks except the first one to be invisible.  So the code for rock 2 would be “create name r2,visible no”.
  2. Build the gears.  By gears, I mean the objects that contain the code that make it work, placed off to the side.  Now there are two ways to do this.  Here’s the easy way for this particular example:

 

Gear #1 would look like this – create name ra1,animate me . 1 1 0;adone visible r1 no,visible r2 on

 

Now the first gear is special since it starts the animation out.  Before explaining, here’s the next one:

 

Gear #2 – create name ra1,animate me . 1 1 1000;adone visible r2 no,visible r3 on

 

Here’s a break down of the code:

 

Create name ra1 – the name of the gears.  It must be named so you can have a way of starting the gears.  More on this later.

 

Animate – is the code to give the object an animation.  This was intended to method of having a set of like textures scroll, such as the steam texture.

 

Me – tells AW to apply the texture to object the code was written on.

 

. – the period just means there is no visible texture.   For the sake of AAA animation, we always just leave this as a period.  Though if you wanted to apply the wood1 texture, it would be wood1. instead (as long as it ends in period).  The only time you wouldn't use a period would be if you wanted a texture to scroll.  Only textures with the same name, but a different number, can scroll (such as wood1, wood2, wood3).  However this is outside the scope of the guide.

 

1 1 – image count, and frame count.  Both are useless for AAA animation, so just leave as 1 1.

 

0 (for gear 1) or 1000 (for gear 2) – This is very important.  It determines the length of the frame.  If you want each frame in the rock’s movement to be one second, you'd use 1000 (1000 milliseconds).  If you wanted a half second, you’d use 500.  Now gear 1 is a 0 delay because it starts the animation out.  This means that as soon as the user starts the AAA animation, the first gear will do its work instantly, instead of waiting 1000 milliseconds.  However, because all the gears are given the same name (ra1), they will all start the delay countdown.  So if you start the AAA animation, it starts it for all the gears.  The only difference is that the effects of gear 2 happen a second after gear 1.  Gear 3 might have a 2 second (2000) delay, so 2 seconds later, gear 2’s results happen.

 

Adone – this is a trigger, just like create, activate, and bump.  It means “animation done”, meaning that when that 1000 millisecond animation is complete, to execute the following orders.

 

Visible r1 no – this is one of the following orders.  When the animation is done, it turns the visibility of r1 (the first rock we named) to no, making it invisible.

 

Visible r2 on – at the exact same moment, it turns the visibility of rock 2 on, making it look like it moved.

 

 

So in review, here are all the codes

 

Rock 1 – create name r1

Rock 2 – create name r2,visible no

Rock 3 – create name r3,visible no

Rock 4 – create name r4,visible no

 

Gear 1 – create name ra1,animate me . 1 1 0;adone visible r1 no,visible r2 on

Gear 2 – create name ra1,animate me .1 1 1000;adone visible r2 no,visible r3 on

Gear 3 – create name ra1,animate me . 1 1 2000;adone visible r3 no,visible r4 on

 

Now you’re going to need something to start the animation.  Build a button or something and give it this command

 

Button – activate astart ra1

 

What this means is that if you click the button, it will astart (animation start) all the objects with the name ra1, which would be our gears.

 

 

 

Method 2 of AAA and Gear Stoppers

 

 

 

You can also do it like this, and you may find it useful for some of your more complex projects:

 

Gear 1 – create name ra1,animate me . 1 1 0;adone visible r1 no,visible r2 on,astart ra2

Gear 2 – create name ra2,animate me . 1 1 1000;adone visible r2 no,visible r3 on,astart ra3

Gear 3 – create name ra3,animate me . 1 1 1000;adone visible r3 no,visible r4 on

 

This makes it so that when the 1000 delay is over, it will start the next gear in line.  It can be useful for loop effects.  It’s also useful for something called a “stopper” or  “gear stopper”.  For very complicated AAA, you can set up a gear to prevent other gears from working, until the Gear Stopper is stopped.

 

Stopper – create name rstop1,animate me . 1 1 0,astart;adone astop ra1,astart

 

Note the use of “astart” this time.  As soon as this gear comes onto the scene, it’ll be working.  The 0 delay, plus the “astart” at the end of the code, makes it start itself over and over as fast as it can.  What it’s doing is stopping the gear called ra1, preventing it from working.  You might make an object with the code “activate astop rstop1” to kill the gear stopper so that r1 may work again.  It's important to note what "astop" is actually doing.  Astop will only stop an animation that is currently counting down.  If you have a gear with a 2000 delay, it means it's vulnerable to being stopped for 2 seconds.  However if your gear is a 0 delay, the stopper gear has no time to stop that animation.  In such a case, try changing the gear's delay to something low like 10.

 

Stopper gears are a key element to adventure games that don't use a bot.  You could, for example, have a stopper gear prevent an AAA powered event from happening until that special object is picked up, in which case the object would kill the stopper.  I've used stopper gears to make doors that require a 4 digit combo to open.  Each time you enter the right key, it kills one of the gear stoppers.  When all 4 gear stoppers are killed, the door will then open.  If you enter the wrong key, all the gear stoppers are reactivated.

 

 

AAA with move commands

 

 

Now that we have more commands, AAA’s usefulness was altered.

It’s now useful for setting up a sequence of move commands.  However objects can only move in a straight line.  So, what you have to do is build the object at each point where it would change direction.  In our example, lets make a rock move down a road, then hang a left, then another left.

 

Rock 1 – create name r1

Rock 2 – create name r2,visible no

Rock 3 – create name r3,visible no

 

Gear 1 – create name ra1,animate me . 1 1 0;adone move 10 name=r1

Gear 2 – create name ra1,animate me . 1 1 1000;adone move 0 0 -10 name=r2,visible r1 no,visible r2 on

Gear 3 – create name ra1,animate me . 1 1 2000;adone -10 name=r3,visible r2 no,visible r3 on

 

Button – activate astart ra1

 

The first rock moves 10 west, then 10 south, the 10 east.

Its important to note delays here.  By default, an object will move to its destination in 1 second.  If I were to add to each move command “time=2”, each gear’s delay would have to be in increments of 2000, not 1000.

 

Also note that if your move commands are more complicated than that, and involve loops and resets, you may need a way of getting objects to cancel out of those loops.  The following code would stop all the rocks from moving.

 

Button – activate move .00001 name=r1, move .00001 name=r2, move .00001 name=r3

 

What this does is move it an extremely small amount (too small to notice).  Unless your gears are still active and applying move commands to your rocks, this should set them back into their place.  If your gears need to be stopped too, add “astop ra1” to your code, or whatever your gears are named.

 

Other things to note

 

As stated earlier, if you want the gear to start working as soon as it's loaded, you use the astart command right after the delay (eg animate me . 1 1 1000,astart).  However, if this gear requires other gears to work properly, they must also be loaded.  If the other gears haven't loaded yet, and one gear is trying to start or stop other gears, you'll have lots of problems.  The only solution to this is to keep all the gears in one cell, since cells load in one big data packet.  Or you could have a master gear which starts everything (that you want started), but it would have a long delay such as 15 seconds (15000).  That way, the user has 15 seconds to load all the gears before the master gear starts the animation.

Also note that if your using the second AAA method, where the gear starts the next gear in line, AND you want it to happen as soon as the user loads the scene, then make sure the first gear and only the first gear is using the astart command.

Other resources:   Official explanation to the Animate command: http://www.activeworlds.com/help/aw36/animate_command.html (includes 3 separate guides)

This guide was written by SW Comit (297649) on October 23rd 2004.  If you have any questions you can telegram me, or contact me in the SW City forums at http://forum.swcity.net.