Main /
Astart Astop Animation
Search:  

Academy Topics

Articles relating to Active Worlds
Help with Objects, Textures, Masks, Coronas, Movers, Avatars, Sequences and more.
Guides on how to do various things in Active Worlds
Graphics, ads and sounds for use.
Downloadable AWG's, Particles, Movers and Building Code

Resources (...)

SW City Network

Overview


Astart Astop Animation (AAA) is a name given and used by the SW City community used to describe action code which is powered by the animate series action commands in AW. These commands are very old in the browser and were the precursor to the create texture command. Besides texturing, it main purpose was to cycle a texture through an object, such as steam1, steam2, etc, creating a slide slow animation. It was most likely not designed to be used the way it is now-a-days, and as a consequence, it is widely considered difficult to learn and use.

Concept of Advanced Usage


So how does this work exactly? Well, AW applies a texture to an object, and after a certain delay passes, will move onto the next texture. Of course, in AAA usage, there is no next texture waiting for it. All AAA cares about is that when AW tries to move onto the next texture, and sees that there is none, it will consider the animation to be done, and it will start the adone trigger.

Adone is a trigger, just like create, activate, and bump are triggers. Any type of command can come after the adone trigger, such as visibilty, texture, and particle tag commands.

Unlike the other basic triggers, adone can be activated by other objects, and it can wait for a delay to happen first. Using those key features, AAA scripting allows for countless applications. You can for example fire a gun, and have a reaction happen after three seconds. Or you can make a series of events happen when opening an epic door in a dungeon.

Code Breakdown


This section explains the code which makes up a typical script. The code is placed on a remote object. A remote object is object whose only purpose is to place code on, and is kept underground out of sight.

create animate me 1. 1 1 5000,astart;adone visible testwall no

  • create: this is the trigger, meaning that all code after it will be applied as soon as it loads.
  • animate: this is the action core, telling AW to expect animate-related syntax to follow.
  • me: this tells AW to apply the following code to the object which the code was written on. You could change this to the name of an object, but there's really no reason to.
  • 1.: this is our dummy texture used in the so-called texture animation. You could use any texture for this, or none at all. If you use no texture, it would simply be a period, however this gives errors in the chat for people with error printing enabled, so I typically leave this to 1, which is actually a texture in the Alpahworld texture path.
  • 1 1: these two numbers are used in the texture animation. We're not doing a texture animation, so leave these numbers alone.

All the code up to this point is the foundation, and is pretty much never changed. For all practical purposes, your AAA code will always start out with create animate me 1. 1 1

  • 5000: this is the delay in milliseconds, an important number. The delay is the length of time that occurs between when the object is loaded, and when the adone trigger will initiate. If you fired a missile and wanted something to happen after five seconds, then you'd use 5000.

At this point, all animate arguments are given, so we end it with a comma.

  • astart: this is also important, so pay attention. If you include astart here, then the animation's delay will start its countdown as soon as the object loads. If you do not include it, the delay will wait for something to start it. You would not include the astart if you wanted a button to activate the AAA scripts.

We now add a semicolon because we're going to move onto the next trigger - adone.

  • adone: as explained earlier, adone is a trigger, and AW will trigger it when the dummy texture animation is done playing. Just like create, all code following it will only occur once its been triggered.

At this point, any sort of action can be applied. This guide assumes you already know how to work with basic actions.

In our example, once AW loads the object containing the AAA script we made, a 5 second countdown will start, and when done, it triggers the adone section of code, which removes visibility from an object given the name testwall.

Simple Example


Let's make a wall disappear five seconds after clicking a button. You'd build the wall, and give it a name. Let's use testwall (create name testwall). Then build the remote object and place the AAA script. It should look something like this:

create name testwalla,animate me 1. 1 1 5000,astart;adone visible testwall no

You may notice one difference between that code and the code in the breakdown section - it's been given a name and the astart has been removed. Astart was removed because we want a button to start it, we don't want it starting as soon as it loads. We gave it a name too, which the button will call on to start the animation. You can give it any name you want but I normally use the name of the objects I'm manipulating (testwall), and adding an a at the end meaning animation.

Now build a button and give it the activation code:

activate astart testwalla

When clicked (activated), it will apply astart to our AAA script. It should now run the adone code after the five second delay has finished. The wall will disappear after five seconds.

Advanced Example


In our example, we want to fire a missile using a button. The missile will launch and the arm holding the missile will retract, then missile will explode two seconds later.

Click to teleport to the in-world example

Setting the Scene

First you need to build and name everything. So, build the missile, and give it a name. We'll call it mis1. The retracting arm was given the name arm1. The explosion was built using a particle emitter given the tag name exp1. When a tag is given to an emitter, it will not emit untill something tells it to, which in this case will be the AAA script. Build a launch button with the code activate astart misa1, which is what we'll be naming our AAA scripts.

Next, build a remote object and give it this code:

create name misa1,animate me 1. 1 1 0;adone move 0 0 100 time=2 name=mis1,move 0 -2 time=3 wait=9e9 name=arm1

The first AAA script was given the name misa1, which the launching button will call upon to start the script. It was given a zero delay so the button will have instant feedback.
*Alternatively, because there's no delay, you could simply move all the adone code directly to the launch button in the form of an activate command, but we're not doing that to keep the cell space clear around the launch pad. It's also easier to manage through remote commands.

The adone section of the code will move the missile 100 meters north in two seconds' time. It will also move the launchpad arm down 2 meters.

Next build another remote object and give it this code:

create name misa1,animate me 1. 1 1 2000;adone visible mis1 no,tag exp1

This script is also named misa1, so the launch button will activate this script too. Unlike the first script, this one has a two second delay, which corresponds with the time it takes the missile to fly to where our explosion is set to happen. After two seconds have passed, it will make the missile itself turn invisible, and set off the explosion with the tag command, used by particle emitters.

You could keep adding more events by adding more remote objects with scripts with longer delays.

Looping Example


AAA scripts can also astart other AAA scripts, which means you can set up a loop animation. For example, say you had four frames in an animation. One frame is named f1, the other f2, another f3, and the last f4. We want their visibility to cycle on and off to simulate that they're moving around. In this example the loop animation will start as soon as it loads. There are four frames, so we need four scripts. They are:

create name fa1,animate me . 1 1 1000,astart;adone visible f1 no,visible f2 on,astart fa2

create name fa2,animate me . 1 1 1000;adone visible f2 no,visible f3 on,astart fa3

create name fa3,animate me . 1 1 1000;adone visible f3 no,visible f4 on,astart fa4

create name fa4,animate me . 1 1 1000;adone visible f4 no,visible f1 on,astart fa1

The first script has the astart command, so that it will start the script once it loads. The others do not have this because they are started up by the previous script. Once the second delay is done in the first script, it will toggle the visibilities of the frames, and astart the next script, and so on.

One final note: Because the script starts as soon as it loads, thanks to the astart, you'll want to make sure that all the scripts are on remote objects that are in the same cell. Otherwise, one script might start running, and then try to astart a script that's in another cell that hasn't loaded yet.

Page last modified on January 18, 2007, at 07:37 PM
Edit SideBar Edit Page | Page History | Print