Don't click here unless you want to be banned.

LSL Wiki : LibraryDanceMachine

HomePage :: PageIndex :: RecentChanges :: RecentlyCommented :: UserSettings :: You are crawl338.us.archive.org
Originally posted in the forums here.

Well, a while back, about a 2 weeks or so before the single prim dance machines were released, I developed my own dance scripts which allowed all the animations to be kept in ONE PRIM. Of course, it had a slight design flaw, in that it still had a ball for every person.

Now i'm NOT SAYING that I was the first to create this. I am well aware that anyone else could have been developing this/had one in world before/at the same time as me.

But now that I see this new, single prim, dance machine released, and all of the arguments and competition brought with it, I have no choice but to release my script for FREE to everyone.

If i tried to sell this, people would get mad because I'm ruining their business. If I set it for free,(nomod) nobody would use it because it doesnt have enough 'features. This particular single prim dance machine may not be advanced as the others, but since you have full rights to modify and copy this script (Reselling the original or a modified version is NOT ALLOWED!*), you can advance it as much as you want, and post updated code here.

* If you do modify it, you may only give it away for free with FULL permissions, and may NOT remove my name from it, the footers, or claim any credit to something you did NOT do.

Now that my little blob is over, here's the good stuff (yeah, there's a lack of comments, but it shouldnt be too hard to figure alot of this stuff out. No support provided other than what I post at the bottom)

Main animation script. Name: "mainanim #"
Where # is a number from 1 to whatever. Refer to bottom for setup help.

key prekey; 
key DancerKey = NULL_KEY; 
string Dance = "jump"; 
string OldDance = Dance; 
integer scriptnum; 

reset() 
{ 
    llMessageLinked(0, 0, "cancel", prekey); 
    prekey = NULL_KEY; 
    DancerKey = NULL_KEY; 
    //llSensorRemove(); 
    llSetTimerEvent(0); 
} 

default 
{ 
    state_entry() 
    { 
        scriptnum = llList2Integer(llParseString2List(llGetScriptName(  ),["mainanim "],[]),0); 
    } 
     
    on_rez(integer start_param) 
    { 
        llResetScript(); 
    } 
     
    link_message(integer sender_num, integer num, string msg, key id) 
    { 
        if (num != 256) 
        { 
            if (msg == "start" && num == scriptnum) 
            { 
                if (DancerKey == NULL_KEY && prekey != id) 
                { 
                    prekey = id; 
                    llRequestPermissions(prekey, PERMISSION_TRIGGER_ANIMATION); 
                    llSetTimerEvent(10); 
                }else{ 
                    llMessageLinked(0, num + 1, msg, id); 
                } 
            } 
            else if (prekey == id && msg == "stop") 
            { 
                if (DancerKey == id) llStopAnimation(Dance); 
                reset(); 
            } 
        }else{ 
            if (DancerKey != NULL_KEY) 
            { 
                if (llGetPermissions() & PERMISSION_TRIGGER_ANIMATION) 
                { 
                    OldDance = Dance; 
                    Dance = llGetInventoryName(INVENTORY_ANIMATION, (integer)msg); 
                    llSensor("", DancerKey, AGENT, 96.0, TWO_PI); 
                }else{ 
                    //llStopAnimation(Dance); 
                    reset(); 
                } 
                 
            }else if (DancerKey == NULL_KEY) 
            { 
                OldDance = Dance; 
                Dance = llGetInventoryName(INVENTORY_ANIMATION, (integer)msg); 
            } 
        } 
    } 
     
    no_sensor() 
    { 
        //if (DancerKey != llGetOwner()) 
        //{ 
            //llStopAnimation(Dance); 
            reset(); 
        //} 
    } 
     
    sensor(integer n) 
    { 
        llStopAnimation(OldDance); 
        llStartAnimation(Dance); 
    } 
     
    run_time_permissions(integer perms) 
    { 
        llSetTimerEvent(0); 
        if (perms & PERMISSION_TRIGGER_ANIMATION) 
        { 
            DancerKey = prekey; 
            //llSensorRepeat("", DancerKey, AGENT, 96.0, TWO_PI, 30.0); 
            llStartAnimation(Dance); 
        }else{ 
            reset(); 
        } 
    } 
    timer() 
    { 
        reset(); 
    } 
} 

//////////////////////////////////////////////////////////////////////// 
// 
//  Solop(rim) Dance version 1.1c MAINANIM 
//  by Evil Fool 
//  Copyright (c) 2004 by Michael Goetz 
//  All Rights Reserved 
// 
//  Permission to Use and Redistribute 
// 
//  Permission to use and redistribute the Solop Dance code, with or 
//  without modifications, is granted under the following conditions: 
// 
//  + All redistributions must include this copyright notice and license. 
//  + All redistributions must allow the next user to view, modify, and 
//    redistribute this code, containing this copyright notice and license. 
//  + All redistributions must give credit to the author, by real name 
//    (Michael Goetz) and by SL name (Evil Fool).  If distributed in a 
//    modified form, credit must still be given to Evil Fool (Michael 
//    Goetz) as the original author. 
//  + All redistributions *should* include a notecard or documentation 
//    containing instructions for proper use and setup. 
// 
////////////////////////////////////////////////////////////////////////

Script Name: "Solop Server"
Basically synchronizes the scripts and keeps track of who is doing what.
Can be de-synchronized with a bit of modification.
Listens can be removed for a touch-only version.

11 fixed for numanims, allows nearly UNLIMITED animations!

integer length = 20; // change for # of seconds to play each anim

integer danceslots = 30; // how many "mainscripts" you have in the object.

integer numdances;
integer curranim;
//list dances;
list dancers;
list STOP_MENU = ["OK"];
integer IM_Dancer = TRUE;

updatetext()
{
    llSetText(llGetObjectName() + "\n Solop Dance 1.1a by Evil Fool.\n Dancing: " + (string)llGetListLength(dancers) + " of " + (string)danceslots + "\n" + (string)numdances + " Dances Loaded!\n Current Dance: " + llGetInventoryName(INVENTORY_ANIMATION, curranim), <1,0,1>, 1);
}
default
{
    touch_start(integer num_detected)
    {
        integer i;
        for (i = 0; i < num_detected; i++)
        {
            key currkey = llDetectedKey(i);
            integer d = llListFindList(dancers, [currkey]);
            if ( (d == -1) && (llGetListLength(dancers) < danceslots) )
            {
                dancers = dancers + [currkey];
                if (IM_Dancer)
                {
                    llInstantMessage(currkey, "Say or shout /99stop or touch again to stop dancing.");
                }
                else
                {
                    llDialog(currkey,"Say or shout /99stop or touch again to stop dancing.", STOP_MENU, -99);
                }
                llMessageLinked(0,1,"start",currkey);
            }else if (d != -1){
                dancers = llDeleteSubList(dancers, d, d);
                llMessageLinked(0,0,"stop",currkey);
            }else{
                llInstantMessage(currkey, "Sorry, but all the available dance slots are used. Please check back soon!");
            }
            updatetext();
        }
    }
    
    link_message(integer sender_num, integer num, string msg, key id)
    {
        if (msg == "cancel")
        {
            integer fk = llListFindList(dancers, [id]);
            if (fk != -1)
                dancers = llDeleteSubList(dancers, fk, fk);
            updatetext();
        }
    }
    
    state_entry()
    {
        //danceslots = llGetInventoryNumber(INVENTORY_SCRIPT) - 1; // slightly more dynamic, but commented for forum-version, check the top of script to change this...
        numdances = llGetInventoryNumber(INVENTORY_ANIMATION);
        integer i;
        //for (i = 0; i < numdances; i++) // no longer needed , uses numbers now :D
            //dances = dances + [llGetInventoryName(INVENTORY_ANIMATION, i)];
        llSetTimerEvent(length);
        llListen( 99, "", NULL_KEY, "" );
        updatetext();
    }
    
    listen ( integer channel, string name, key id, string message )
    {
        integer i;

        if ( channel == -99 ) return;
                
        if ( message == "stop" )
        {
            integer d = llListFindList(dancers, [id]);
            if (d != -1)
            {
                dancers = llDeleteSubList(dancers, d, d);
                llMessageLinked(0,0,"stop",id);
            }
        }
        
        if ( message == "list" && id == llGetOwner())
        {
            for ( i = 0; i < numdances; i++ )
            {
                llWhisper(0, llGetInventoryName(INVENTORY_ANIMATION, i));
            }
        }
        
        if ( message == "reset" && id == llGetOwner())
        {
            key dancerkey;
            for ( i = 0; i < llGetListLength(dancers); i++ )
            {
                dancerkey = llList2Key(dancers, i);
                llMessageLinked(0,0,"stop",dancerkey);
            }
            dancers = [];
            llResetScript();
        }
        
        if (message == "dancers" )
        {
            for ( i = 0; i < llGetListLength(dancers); i++ )
            {
                llInstantMessage(id, llKey2Name(llList2Key(dancers, i)));
            }
        }
        
    }
    

    timer()
    {
        if (curranim >= numdances)
        {
            curranim = 0;
        }
        llMessageLinked(0, 256, (string)curranim, NULL_KEY);
        updatetext();
        curranim++;
    }
    
    on_rez(integer sparam){llResetScript();}
}

////////////////////////////////////////////////////////////////////////
//
//  Solop(rim) Dance version 1.1a SOLOPSERVER
//  by Evil Fool
//  Copyright (c) 2004 by Michael Goetz
//  All Rights Reserved
//
//  Permission to Use and Redistribute
//
//  Permission to use and redistribute the Solop Dance code, with or
//  without modifications, is granted under the following conditions:
//
//  + All redistributions must include this copyright notice and license.
//  + All redistributions must allow the next user to view, modify, and
//    redistribute this code, containing this copyright notice and license.
//  + All redistributions must give credit to the author, by real name
//    (Michael Goetz) and by SL name (Evil Fool).  If distributed in a
//    modified form, credit must still be given to Evil Fool (Michael
//    Goetz) as the original author.
//  + All redistributions *should* include a notecard or documentation 
//    containing instructions for proper use and setup.
//
////////////////////////////////////////////////////////////////////////

Now for the instructions (good luck)

In your inventory, create a folder create 2 scripts in there, "Solop Server" and "mainanim".
Paste the Solop Server code into the Solop Server script, and the mainanim # code into the mainanim script.
Drag both scripts onto the prim.
Keep dragging copies of mainanim onto the prim, until you have the number of supported dancers you want. Once you do this, delete the original mainanim script, then go into each of the others, and type a single letter into the script, and then press backspace, to put it back how it was before. Then, save it and check the running box.
Finish this for all your scripts, then use Tools: recompile scripts in selection. For any script missing from that list, go back into the prim, and repeat the above process, until all the scripts appear in that list
next, open up the Solop Dance script, the one inside the object, and close the edit box, keeping the script open. Drag all the dances you want into the prim, then wait a second, and click Reset on the server script dialog.
There is no comment on this page. [Display comments/form]