Change font size
It is currently Sat Dec 15, 2018 1:52 pm

Forum rules


{L_IMAGE}



Post a new topicPost a reply Page 1 of 1   [ 1 post ]
Author Message
 Post subject: Random Animation Script
PostPosted: Sat Mar 05, 2011 4:50 pm 

Joined: Sat Mar 05, 2011 4:44 pm
Posts: 2
Put Script in Objekt with Animations

{L_CODE}:
// Copyright 2010 (C) takuto Hastings
// modifed by takuto Hastings



// Jippen Faddoul's Poseball script - Low ram/lag posepall thats just drag-and drop simple
// Copyright (C) 2007 Jippen Faddoul
//    This program is free software: you can redistribute it and/or modify
//    it under the terms of the GNU General Public License version 3, as
//    published by the Free Software Foundation.
//
//    This program is distributed in the hope that it will be useful,
//    but WITHOUT ANY WARRANTY; without even the implied warranty of
//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//    GNU General Public License for more details.
//
//   You should have received a copy of the GNU General Public License
//    along with this program.  If not, see <http://www.gnu.org/licenses/>



//This text will appear in the floating title above the ball
string TITLE="Dance the Pole";           
//You can play with these numbers to adjust how far the person sits from the ball. ( <X,Y,Z> )
vector offset=<0.0,0.0,0.5>;           
vector rot=<0.0,0.0,0.0>;
integer INTERVAL = 30;  // each pose time
///////////////////// LEAVE THIS ALONE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
//string ANIMATION;
integer visible = TRUE;
key avatar;

vector COLOR = <1.0,1.0,1.0>;
float ALPHA_ON = 1.0;
float ALPHA_OFF = 0.0;

integer animation_count;
integer last_animation = -1;

start_animation_randam() {
    if (last_animation == -1)
        llStopAnimation("PoleDance");
    else
        llStopAnimation(llGetInventoryName(INVENTORY_ANIMATION, last_animation));
       
    last_animation = (integer)llFrand(animation_count);
//  llSay(0,(string)last_animation);
    llStartAnimation(llGetInventoryName(INVENTORY_ANIMATION, last_animation));
}

show(){
    visible = TRUE;
    llSetText(TITLE, COLOR,ALPHA_ON);       
    llSetAlpha(ALPHA_ON, ALL_SIDES);
}

hide(){
    visible = FALSE;
    llSetText("", COLOR,ALPHA_ON);       
    llSetAlpha(ALPHA_OFF, ALL_SIDES);
}

default{
    state_entry() {
        llSitTarget(offset, llEuler2Rot(rot * DEG_TO_RAD));
        if((animation_count = llGetInventoryNumber(INVENTORY_ANIMATION)) <= 0){
            llWhisper(0, "Error: No animation");
            //ANIMATION = "sit";
        }
        llSetSitText(TITLE);
        show();
    }

//    touch_start(integer detected) {
//        //llOwnerSay("Memory: " + (string)llGetFreeMemory());
//        if(visible){ hide(); }
//        else       { show(); }
//    }

    changed(integer change) {
        if(change & CHANGED_LINK) {
            avatar = llAvatarOnSitTarget();
            if(avatar != NULL_KEY){
                //SOMEONE SAT DOWN
                hide();
                llRequestPermissions(avatar,PERMISSION_TRIGGER_ANIMATION);
                return;
            }else{
                //SOMEONE STOOD UP
                if (llGetPermissionsKey() != NULL_KEY){
                    llStopAnimation(llGetInventoryName(INVENTORY_ANIMATION, last_animation));
                }
                last_animation = -1;
                llSetTimerEvent(0);
                show();
                return;
            }
        }
        if(change & CHANGED_INVENTORY) { llResetScript(); }
        if(change & CHANGED_OWNER)     { llResetScript(); }
    }

    run_time_permissions(integer perm) {
        if(perm & PERMISSION_TRIGGER_ANIMATION) {
            start_animation_randam();
            llSetTimerEvent(INTERVAL);
            hide();
        }
    }
   
    timer() {
        start_animation_randam();
    }
}


Top
 Profile  
 
Display posts from previous:  Sort by  
Post a new topicPost a reply Page 1 of 1   [ 1 post ]


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  


Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
610nm Style by Daniel St. Jules of Gamexe.net