Animating the birds nest in Second Life

Join us in Outworldz at www.outworldz.com:9000 or follow us:

How to make an animal and make it move using Archipelis for Second Life

Previous: Loading your project into Second Life

This is Step : Animating the birds nest in Second Life

Animating the Nest

The first step in animating your birds nest is to upload two scripts.

You will need a copy of my Prim Animator scripts. There are two scripts that you can use: a note card driven one, and a database-driven one. The note card version is used entirely in-world. It can handle about 200 movements before it will run out of memory. The database version allows you to avoid the note cards and copying and pasting of coordinates. It has no limit on how many animations you can use before you run out of memory.

For this example, we are going to use the database script. The scripts are available from the zip file

Get the zip file, expand it, and open each script in WordPad or notepad. (WordPad is far better). Save the 3 scripts that are inside.

Script 1: Animator.lsl - the main animator program

Script 2: Store 0.lsl - A expandable database script. More than one script can be used to store large animations

Script 3: movement.lsl - a simple test program to make the bird play 3 animations in a loop

Important step: Edit your birds nest. Give the birds nest a unique name. The Prim Animator can be used to save the data in an external database by this name.

While you are editing, check that the bird nest is be outlined in Yellow. The birds nest is the root prim that all movements are made from when it is outlined in yellow.

Create two new scripts, Animator, and Store 0. Put these two scripts in the Object Tab. The Animation script contains the menu logic and control systems. The 'Store 0' script is a small database, that can hold about 200 prim movements. This can be a prim moved 200 times, 200 prims moved once, or 100 prims moved twice. Make sure you compile your scripts using the 'mono' setting for maximum storage room.

There must be at least one 'Store 0' script. Store 0 can be added again and again, provided you number them sequentially, as in Store 0, Store 1, Store 2 and so on. This allows almost unlimited storage of movements. In this case, we are going to be making a small set of animations, so we can get by with a single storage script.

Now close the edit window, and click your birds nest If all went well, you should get this menu:

Here is a chart of what each menu item does.:

menu graphic

Recordings will display a list of an recordings you have made. You can click the name to play the animation. Play All will play all animations in order.

Erase will delete the data that is stored in case you need to start over. Load will fetch the data from the server. Publish will save any animations to the server.

You can g I've an animation a Name, Record an animation, and insert a 0.1 second Pause .

Baseline Recording

The first step in recording an animation is typically to make a baseline recording. A baseline sets all of the prims to a default position. This is not always needed. If you are just moving a few prims, you can skip this step. I like to always use a baseline recording so that I can set all the prims to a known state.

Click the nest. Then click the Name button. A menu will appear prompting you for a name. Type the word 'start' and click "save'.

Click the menu item 'Recordings' and you will see there is a placeholder for the animation. Since nothing has been recorded, clicking it has no effect.

Now edit the nest. You should see all the prims highlight. Now select the Edit Linked Prims checkbox in the General Tab. Click the nest so that it is unselected. For a baseline recording, we need to move all the child prims slightly to set them at a known position. Now move every prim slightly.

Exit the editor, and click 'Record'.

Now repeat the above steps to record you next animation:

Click Name

Type the name 'baby1'

Move the mother bird so she is feeding one baby bird. You can move any prims in the baby or mother to position her correctly.

Click Record

Click Name

Type the name 'baby2'

Move the mother bird so she is feeding the other baby bird.

You can click the menu item 'Recordings' to see how each animation works.

Now is a good time to publish your baseline. Clicking the Publish button will save all of the prim locations to the server. If you reset the scripts in your bird, you will lose the recording. Saving to the database lets you recover them later. You should see a counter change every 10 seconds as the animations are saved.

For a test, click Erase, and then click Load. This will fetch the recordings from the server. The saving and loading takes 1 second per prim animation. This is due to a LSL server limitation.

Now click the bird one last time and click 'Finish' Finish will remove the main recording menu. Only you as the owner can play back the animations after clicking the nest.

Looping the animations

I have more example scripts to control your nest at this link.

You can add a script so the animations can play back in some arbitrary order. The following script will play animation ;start', followed by 'baby1 and 'baby2' in order, once every 2 seconds.

integer counter;

list animations = ["start","baby1","baby2"];
default
{
    state_entry()
    {
        llSetTimerEvent(2);
    }
    timer()
    {
        string name = llList2String(animations, counter);
        llMessageLinked(LINK_SET,1,name,"");

        if (counter++ >= llGetListLength(animations)-1)
            counter = 0;
    }
}

Enjoy your new birds nest!

Back to start

Back to the Best Free Tools in Second Life and OpenSim.