Dance Poseball

//////////////////////////////////////////// 
// Animation Script v1.2.1 
// 
// Written by Xylor Baysklef 
//////////////////////////////////////////// 
 
/////////////// CONSTANTS /////////////////// 
list ANIMATIONS  = [ "Club Dance 1" ]; 
list ANIMATIONS2 = [ "Club Dance 2" ]; 
list ANIMATIONS3 = [ "Club Dance 3" ]; 
list ANIMATIONS4 = [ "Club Dance 4" ]; 
///////////// END CONSTANTS ///////////////// 
 
///////////// GLOBAL VARIABLES /////////////// 
//integer gToggle = 0; 
integer gAnimNumber; 
integer gTotalAnims; 
 
string gAnimName = "type"; 
/////////// END GLOBAL VARIABLES ///////////// 
 
default { 
    state_entry() { 
        //llSay(0, "Init..."); 
        llRequestPermissions(llGetOwner(), PERMISSION_TRIGGER_ANIMATION); 
         
        ANIMATIONS += ANIMATIONS2; 
        ANIMATIONS2 = []; 
         
        gTotalAnims = llGetListLength(ANIMATIONS); 
        gAnimNumber = -1; 
        llListen(0, "", llGetOwner(), ""); 
    } 
     
    on_rez(integer param) { 
        //llGiveInventory(llGetOwner(), "Animation Names"); 
        llResetScript(); 
    } 
     
    listen(integer channel, string name, key id, string mesg) { 
        string preamble = llGetSubString(mesg, 0, 3); 
        if (preamble != "anim" && preamble != "stop") 
            return; 
                 
        integer perm = llGetPermissions(); 
         
        if ( !(perm & PERMISSION_TRIGGER_ANIMATION)) {             
            llRequestPermissions(llGetOwner(), PERMISSION_TRIGGER_ANIMATION); 
            return; 
        } 
         
        list parsed = llParseString2List(mesg, [ " " ], []); 
        //llSay(0, (string)parsed); 
         
        string anim = llList2String(parsed, 1); 
         
        if (preamble == "stop") { 
            //llSay(0, "Stopping: " + llGetAnimation(llGetOwner())); 
            //llStopAnimation(llGetAnimation(llGetOwner())); 
            if (anim == "") 
                anim = gAnimName; 
                         
            if (anim == "all") { 
                integer i; 
                llSay(0, "Stopping all animations... please wait."); 
                for (i=0; i<gTotalAnims; i++) 
                    llStopAnimation(llList2String(ANIMATIONS, i)); 
                     
                llSay(0, "Done."); 
                     
                return; 
            } 
                 
            //llSay(0, "Stopping: " + anim); 
            llStopAnimation(anim); 
            return; 
        } 
                 
        gAnimName = anim; 
        //llSay(0, "Animation: " + gAnimName); 
        llStartAnimation(gAnimName);             
    } 
     
    run_time_permissions(integer perm) { 
        //llStopAnimation(gAnimName); 
        //gToggle = 0; 
    } 
     
    attach(key id) { 
        integer perm = llGetPermissions(); 
         
        if (id != NULL_KEY) {         
         
            if (! (perm & PERMISSION_TRIGGER_ANIMATION)) { 
                llRequestPermissions(llGetOwner(), PERMISSION_TRIGGER_ANIMATION); 
            }                 
        } 
        else { 
             
            if (perm & PERMISSION_TRIGGER_ANIMATION) { 
                llStopAnimation(gAnimName); 
            } 
        } 
    } 
 
    touch_start(integer total_number) { 
        if (llDetectedKey(0) != llGetOwner()) 
            return; 
         
        integer perm = llGetPermissions(); 
         
        if (perm & PERMISSION_TRIGGER_ANIMATION) { 
            if (gAnimNumber != -1) { 
                llStopAnimation( llList2String(ANIMATIONS, gAnimNumber) ); 
            } 
                 
             
            gAnimNumber++; 
            if (gAnimNumber == gTotalAnims) 
                gAnimNumber = 0; 
                 
            gAnimName = llList2String(ANIMATIONS, gAnimNumber); 
             
            llStartAnimation( gAnimName ); 
            llSay(0, "Animation: " + gAnimName); 
        } 
        else { 
            llRequestPermissions(llGetOwner(), PERMISSION_TRIGGER_ANIMATION); 
        } 
    } 
}
Navigation

Alternative Startseite
Helpdesk
Links
Maps
Radio
Suchmaschine


Drucken/exportieren