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

This prim animator compiler is a very useful and easy to use script for Second Life and OpenSim. Setup is very simple. I based it on an excellent script by Allen Firethorn. Just drop the two script into the object, click the object, and give your animation a name. Move all the prims around, and click Record. When done, click the Compile button. It writes fast, optimized code for you.

  • Create as many animation scripts as you want
  • Record variable pauses in any animation
  • Optimizes memory use (in Second Life) to be as small as possible
  • Easily editable output
  • Compatible with my other prim animator

Great Features and a great price - Free!

  • Fast drag & drop setup - just put two scripts into a prim and click
  • Easy menu driven control
  • Works on attachments or stand-alone prim sets
  • Customizable playback behavior with sample add-on scripts
  • Built-in low lag optimization and no-delay animations using the latest LSL commands
  • Scripter friendly API - accepts link messages and chatted commands
  • Fully scalable/resizable animations, even after you have recorded your creation!
  • No recording limit - use multiple scripts to animate past the LSL 64K limit
  • Records position, rotation, and scale of every child prim
  • No Note cards!

Unlike other $$ prim puppeteers and animators, there is no need to rename any prims, no need to rez and re-rez, no need to depend upon external servers, and no need for note cards. It's also expandable and can take commands from other scripts. There is no delay between prim movements like older animators. And best of all, it is open source!

Easy menu driven controls:

Menu

Animation Storage: You can compile your animations to one or more scripts . Since each script can hold hundreds of animations, you can have 127 scripts in a prim, and a prim can have 127 other prims, the uses are number of movements are practically limitless.

API support: If you have some scripting knowledge, you can use Linked Messages to can control your animation in any way you want. You can also type commands into main chat or a private chat channel. Scripts can control your animation anywhere on your sim.

Simple step by step directions

Make one prim and add these two scripts:  download the scripts from the LSL library

Add one or more child prims, and link them to the first prim. Make sure the first prim is the last one you click, then press Ctrl-L to link them together.

Here is a simple demo: I made 15 prims to animate, and a box by itself that will hold the scripts.

15 prims

I put both scripts inside the main box, and then linked them all together, and I clicked the box on the far left last so it will be the root prim.

Click any prim to get the menu:

Menu

Recording your first animation

The first step is to name your animation. Click 'Name' on the Menu. The script will tell you to type the name in on a secret channel and it will pop up a Text Box to type it in. You can use either way  (TextBox is not supported on older viewers)..

"Enter a new name, or type the animation name on channel /646"

box

Type in a name such as 'Test', for our first prim recording and press Submit..

Test ENtered

The script will tell you to position all the child prims.

[17:12] Primitive: Recording is ready for animation 'Test'
[17:12] Primitive: Position any child prims, then select the menu item 'Record', and repeat as necessary. When finished, click 'Compile' to save the animation, or click the animation name to play it back. Click 'Name' to start a new animation sequence

Right-Click the boxes, and select edit.

The 'root' prim will be highlighted in yellow:

All selected

Now select "Edit Linked Parts":

Edit Linked Parts

Press and hold the Shift key and click the root prim to unselect it:

Shoft Key and click the root prim

Now move any prims you want for the "test" animation.

I chose to move all 15 prims just a little bit to one side:

Moved to one side

Select the menu item 'Record'.

Move some more child prims and rotate it, as I have done below, by 90degrees:

Rotated

Click Record

Click Pause. The system will ask you for a time to wait, in milliseconds. Enter 1000 to add a 1 second delay

Click the name "Test" in the menu , and watch it play back.

 

Finishing up

You can use the script as a menu driven prim animator by clicking "Finish", or you can make code that runs without a menu by clicking "Compile".

If you click Finish, you will not be able to make any more changes!

You can still click the prim and click the names of the menus that you gave recorded.  You can have as many as 12 animations. Finish will also delete the Compiler script.

 

Compiling to LSL

The Compile button will produce LSL code that repeats all of your movements.   You save this code in a new script. You can has as many of these scripts have as you want and build up a large library of animations.

 Compiling has a speed and flexibility that the "Finish: button does not have.   But you have to trigger your animation with yet another script.   

When you have moved the prims around and are satisfied, click Compile to print the saved coordinates. These must be saved in a new script for playback.

Here is a sample output from the compiler that has just one prim moved:

[08:58] Primitive: Compiler processing 1 prim movements and 1 animations
[08:58] Primitive: Copy everything below this line and paste it into a new script

[08:58] Compiler: // Prim animation compiler //
// Ferd Frederix - http://www.free-lsl-scripts.com
integer playbackchannel = 1; // The default llMessageLinked number
rotation calcChildRot(rotation rdeltaRot){
    if (llGetAttached())
        return rdeltaRot/llGetLocalRot();
    else
        return rdeltaRot/llGetRootRotation();
}
vector originalScale = <0.500000,0.500000,0.500000>;
[08:58] Compiler: test(){
    vector currentSize = llGetScale();
    float scaleby = currentSize.x/originalScale.x;

[08:58] Compiler:     llSetLinkPrimitiveParamsFast(4, [PRIM_POSITION, <2.297594,-1.028168,0.516836>*scaleby, PRIM_ROTATION,calcChildRot(<0.000000,0.719340,0.000000,-0.694658>), PRIM_SIZE, <0.500000,0.500000,0.500000>*scaleby]);
[08:58] Compiler: 
}

default{

[08:58] Compiler: 
    link_message(integer sender_num, integer num, string message, key id){
        if(num == playbackchannel){
            if(message == "test"){
                test();
            }
        }
    }
}
[08:58] Compiler: //  Done!  Copy everything above to a new script, and Search/Replace the [08:58] Compiler: on the left so it is blank

:

Copy and paste all of this into a new script:

Compiler output

You will need to edit the script and click Search-Replace, or type Ctrl-F.

Then enter the name and date [08:58] Compiler :that occurs at the beginning of each line and replace it with nothing so that this is removed.

Triggering

This script can be easily modified to be triggered in various ways, or it can be triggered by link messages.

The syntax to trigger an animation is to send the name on channel number 1 with a link message:

llMessageLinked(LINK_SET,1,"AnimationName",""); // trigger an animation named AnimationName

Trigger scripts:

The first script is a simple touch and playback script. When touched, it plays back animations named 'stand' and 'wag", then the next time it is clicked, it plays 'sit'.


integer flag;

default
{
    touch_start(integer total_number)
    {
        if (flag++ %2 == 0)
        {
            llMessageLinked(LINK_SET,1,"stand",""); // stand on all 4's
            llMessageLinked(LINK_SET,1,"wag",""); // stand on all 4's
        }
        else
            llMessageLinked(LINK_SET,1,"sit","");   // sit on rear     
    }
}

This next script is a sensor script. It starts

by playing a animated called "stand".

If an avatar gets within 5 meters distance, it plays back animation 'sit'. When all avatars have left, it plays a 'stand' animation.

		
// Sensor
integer sitting = FALSE;

default
{
    state_entry()
    {
        llMessageLinked(LINK_SET,1,"stand",""); // stand on all 4's
        llSensorRepeat("","",AGENT,5,PI,5.0);   // look for people within 5 meters every 5 seconds
    }
    
    // found an avatar
    sensor(integer num_detected)
    {     
        if (sitting)
        {
            llMessageLinked(LINK_SET,1,"sit","");   // sit on rear
            sitting = FALSE;
        }
    }
    
    // no one detected?
    no_sensor()
    {
        if (! sitting)
        {
            llMessageLinked(LINK_SET,1,"stand","");     // stand on all 4's
            sitting = TRUE;
        }
    }
}

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