Animator Script

Thread Started By Ap0110

3154
2
  • 52 Vote(s) - 3 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Rate Thread
#1
PHP Code:
//integer gToggle = 0;
integer gAnimNumber;
integer gTotalAnims;
integer gTotalAnims2;
integer gInList2;

string gAnimName "type";


list 
gAnimations = [ "aim_R_bazooka""aim_R_handgun""aim_R_rifle""angry_fingerwag",
"angry_tantrum""away""backflip""blowkiss""bow""brush""clap",
"courtbow""cross_arms""crouch""crouchwalk""curtsy",
"dance1""dance2""dance3""dance4""dance5""dance6""dance7""dance8",
"dead""drink""express_afraid""express_anger""express_bored",
"express_cry""express_embarrased""express_laugh""express_repulsed",
"express_sad""express_shrug""express_surprise""express_wink",
"express_worry""falldown""female_walk""fist_pump""fly""flyslow",
"hello""hold_R_bazooka""hold_R_handgun""hold_R_rifle",
"hold_throw_R""hover""hover_down""hover_up""impatient",
"jump""jumpforjoy""kick_roundhouse_R""kissmybutt""kneel_left",
"kneel_right""land""musclebeach""no_head""no_unhappy",
"nyanya""peace""point_me""point_you""prejump""punch_L",
"punch_onetwo""punch_R""RPS_countdown" ];

list 
gAnimations2 = [ "RPS_paper""RPS_rock",
"RPS_scissors""run""salute""shout""sit""sit_ground""sit_to_stand",
"sleep""slowwalk""smoke_idle""smoke_inhale""smoke_throw_down",
"snapshot""soft_land""stand""standup""stand_1""stand_2",
"stand_3""stand_4""stretch""stride""surf""sword_strike_R",
"talk""throw_R""tryon_shirt""turnback_180""turnleft""turnright",
"turn_180""type""uphillwalk""walk""whisper""whistle""wink_hollywood""yell",
"yes_happy""yes_head""yoga_float" ];

default {
    
state_entry() {
        
//llSay(0, "Init...");
        
llRequestPermissions(llGetOwner(), PERMISSION_TRIGGER_ANIMATION);
        
gTotalAnims llGetListLength(gAnimations);
        
gTotalAnims2 llGetListLength(gAnimations2);
        
gAnimNumber = -1;
        
gInList2 FALSE;
        
llListen(0""llGetOwner(), "");
    }
    
    
on_rez(integer param) {
        
llGiveInventory(llGetOwner(), "Animation Names");
        
llResetScript();
    }
    
    
listen(integer channelstring namekey idstring mesg) {
        
string preamble llGetSubString(mesg03);
        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(parsed1);
        
        if (
preamble == "stop") {
            
//llSay(0, "Stopping: " + llGetAnimation(llGetOwner()));
            //llStopAnimation(llGetAnimation(llGetOwner()));
            
if (anim == "")
                
anim gAnimName;
                        
            if (
anim == "all") {
                
integer i;
                
llSay(0"Stoping");
                for (
i=0i<gTotalAnimsi++)
                    
llStopAnimation(llList2String(gAnimationsi));
                    
                for (
i=0i<gTotalAnims2i++)
                    
llStopAnimation(llList2String(gAnimations2i));
                    
                
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) {
                if (
gInList2)                
                    
llStopAnimationllList2String(gAnimations2gAnimNumber) );
                else
                    
llStopAnimationllList2String(gAnimationsgAnimNumber) );
            }
                
            
            
gAnimNumber++;
            
            if (
gInList2) {
                if (
gAnimNumber == gTotalAnims2) {
                    
gAnimNumber 0;
                    
gInList2 FALSE;
                }
            }
            else {
                if (
gAnimNumber == gTotalAnims) {
                    
gAnimNumber 0;
                    
gInList2 TRUE;
                }
            }
                
            if (
gInList2)
                
gAnimName llList2String(gAnimations2gAnimNumber);
            else
                
gAnimName llList2String(gAnimationsgAnimNumber);
            
            
llStartAnimationgAnimName );
            
llSay(0"Animation: " gAnimName);
        }
        else {
            
llRequestPermissions(llGetOwner(), PERMISSION_TRIGGER_ANIMATION);
        }
    }

Reply


#2
The animation in the script are all builtin or I have to upload somehow?
Reply


#3
Genus and Catya UV devkit
Reply




Possibly Related Threads…
Thread Author Replies Views Last Post
  D-Animator deadpool 0 2,159 02-19-2013, 02:06 AM
Last Post: deadpool

Forum Jump:

1 Guest(s)
Share this:

About Second Life Copybot

Second Life CopyBot Forum is a place where you can get items for Second Life and other vitual worlds for free. With our CopyBot viewers you can export and import any content from these virtual worlds and modify them in 3D software such as Blender, 3D studio Macx etc...