Gat Avatar Days Old

Expired

// Get Days Old
// Travis Lambert -- 10-19-2005 (504 days old) :)  


list lTdy;
list lYmd;
float fYear;
float fMonth;
float fDay;
integer iDayTotal;
float fYMonth;
float fYDay;
float fBornFloat;
float fTmonth;
float fTday;
float fTodayFloat;
float fYearTotal;
string sToday;
string sName;

default 
{ 
    touch_start(integer num_detected) 
    { 
        llRequestAgentData(llDetectedKey(0), DATA_BORN); 
        sName = llDetectedName(0);
        llSetText("Age Detector",<1 ,1,1>,1);
    } 
    dataserver(key kQueryid, string sData) 
    { 
        //determine born date
        list lYmd = llParseString2List(sData, ["-"], []); 
        float fYear = llList2Float(lYmd, 0); 
        float fMonth = llList2Float(lYmd, 1); 
        float fDay = llList2Float(lYmd, 2); 
        
        
        //seperate born month, day, year
        fYMonth = (fMonth / 12);
        fYDay = (fDay / 365);
        fBornFloat = fYear + fYMonth + fYDay;

        
        //determine today's date
        string sToday = llGetDate();
        list lTdy = llParseString2List(sToday, ["-"], []);
        float tyear = llList2Float(lTdy, 0);
        float tmonth = llList2Float(lTdy, 1);
        float tday = llList2Float(lTdy, 2);
        
        //seperate today's month, day, year
        fTmonth = (tmonth / 12);
        fTday = (tday / 365);
        fTodayFloat = tyear + fTmonth + fTday;
                
        
        //total up & compute
        fYearTotal = fTodayFloat - fBornFloat;
        iDayTotal = llRound((float) fYearTotal * 365.0);
        
        llSay(0,sName + " is " + (string) iDayTotal + " Days Old!");
  
        
        
    } 
} 

 

Face Animation

Expired

// Thanks to Catherine Omega, the dialog boxes came to keep showing.
// You can not only just put this script in your attached object, but also
// put into a prim you rez to execute.

integer CHANNEL = 42; // dialog channel

list MENU_UNHAPPY = // The limit of dialog is only twelve. So I cannot help
[ // separating the list.
"disdain", "repulsed", "anger",
"bored", "sad", "cry",
"embarrased", "frawn","shrug",
"afraid", "worry", "surprise"
];

list MENU_HAPPY =
[
"wink", "toungue out", "kiss",
"toothesmile", "smile", "laugh",
"open mouth"
];


default {
state_entry()
{
llListen(CHANNEL, "", NULL_KEY, "");
llRequestPermissions(llGetOwner(), PERMISSION_TRIGGER_ANIMATION);
llInstantMessage(llGetOwner(), "Just typing \"/42menu\", you can express your emotions");
}
on_rez(integer total_number)
{
llResetScript();
}
listen(integer channel, string name, key id, string message)
{

if (llListFindList(MENU_UNHAPPY, [message]) != -1) // verify dialog choice
{
if (message == "afraid")
{
llStartAnimation("express_afraid_emote");
}
if (message == "anger")
{
llStartAnimation("express_anger_emote");
}
if (message == "bored")
{
llStartAnimation("express_bored_emote");
}
if (message == "cry")
{
llStartAnimation("express_cry_emote");
}
if (message == "disdain")
{
llStartAnimation("express_disdain");
}
if (message == "embarrased")
{
llStartAnimation("express_embarrassed_emote");
}
if (message == "frawn")
{
llStartAnimation("express_frown");
}
if (message == "repulsed")
{
llStartAnimation("express_repulsed_emote");
}
if (message == "sad")
{
llStartAnimation("express_sad_emote");
}
if (message == "shrug")
{
llStartAnimation("express_shrug_emote");
}
if (message == "surprise")
{
llStartAnimation("express_surprise_emote");
}
if (message == "worry")
{
llStartAnimation("express_worry_emote");
}
llDialog(llGetOwner(), "What do you want to express?", MENU_UNHAPPY, CHANNEL);
// The dialog box keeps showing until you chose "Ignore".
}
if (llListFindList(MENU_HAPPY, [message]) != -1) // verify dialog choice
{
if (message == "kiss")
{
llStartAnimation("express_kiss");
}
if (message == "laugh")
{
llStartAnimation("express_laugh_emote");
}
if (message == "open mouth")
{
llStartAnimation("express_open_mouth");
}
if (message == "smile")
{
llStartAnimation("express_smile");
}

if (message == "toungue out")
{
llStartAnimation("express_tongue_out");
}
if (message == "toothesmile")
{
llStartAnimation("express_toothsmile");
}
if (message == "wink")
{
llStartAnimation("express_wink_emote");
}
llDialog(llGetOwner(), "What do you want to express?", MENU_HAPPY, CHANNEL);
// The dialog box keeps showing until you chose "Ignore".
}
else if (message == "menu")
//If you cleard the dialog boxes, you could recall them by /42menu.
{
llDialog(llGetOwner(), "What do you want to express?", MENU_UNHAPPY, CHANNEL);
llDialog(llGetOwner(), "What do you want to express?", MENU_HAPPY, CHANNEL);
}
}
}

 

Avatar Alert

Expired

integer switch=0;
key name;

default
{
    state_entry()
    {
        llWhisper(0,"Alert Script Active");
        name = llGetOwner();
    }

    touch_start(integer total_number)
    {
        if(switch==0)
        {
            switch=1;
            llSensorRepeat("","",AGENT,90.0,PI,20.0);
            llWhisper(0,"Alert on");
        }
        else if(switch==1) 
        {
            switch=0;
            llSensorRemove();
            llWhisper(0,"Alert off");
        }   
    }

    sensor(integer total_number)
    {
        vector pos = llGetPos();
        integer j;
        integer count = total_number;
        for (j = 0; j 

 

AO Flip Mod

Expired

// Francis wuz here
//
// modded by FliperPA to cut down on lag by 1000% without cutting much performance
// also set to listen on alternate channel to stop server parsing everything wearer says in chat
// GREAT WORK FRANCIS! :-)
//
// MOD THE NEXT LINE TO CHOOSE WHICH CHANNEL TO RUN ON
integer LISTEN_CHANNEL = 1904;
// Default notecard we read on script_entry
string defaultNoteCard = "*Default Anims";
//
// Don't ask me for tech support. I won't give it.
// Copyright (C) 2004 Francis Chung
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// 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, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  U

// List of all the animation states
list animState = ["Sitting on Ground", "Sitting", "Striding", "Crouching", "CrouchWalking",
                  "Soft Landing", "Standing Up", "Falling Down", "Hovering Down", "Hovering Up",
                  "FlyingSlow", "Flying", "Hovering", "Jumping", "PreJumping", "Running",
                  "Turning Right", "Turning Left", "Walking", "Landing", "Standing" ];
                  
// Index of interesting animations
integer standIndex      = 20;
integer sittingIndex    = 1;
integer sitgroundIndex  = 0;
integer hoverIndex      = 12;
integer flyingIndex     = 11;
integer flyingslowIndex = 10;
integer hoverupIndex    = 9;
integer hoverdownIndex  = 8;
integer waterTreadIndex = 25;
integer swimmingIndex   = 26;
integer swimupIndex     = 27;
integer swimdownIndex   = 28;
integer standingupIndex = 6;

// list of animations that have a different value when underwater
list underwaterAnim = [ hoverIndex, flyingIndex, flyingslowIndex, hoverupIndex, hoverdownIndex ];

// corresponding list of animations that we override the overrider with when underwater
list underwaterOverride = [ waterTreadIndex, swimmingIndex, swimmingIndex, swimupIndex, swimdownIndex];

// list of animation states that we need to stop the default animations for
list stopAnimState = [ "Sitting", "Sitting on Ground" ];

// corresponding list of animations to stop when entering that state
list stopAnimName  = [ "sit", "sit_ground" ];

// Lines in the notecards where to grab animation names
// This list is indexed the same as list overrides
list lineNums = [ 45, // 0  Sitting on Ground
                  33, // 1  Sitting
                   1, // 2  Striding
                  17, // 3  Crouching
                   5, // 4  CrouchWalking
                  39, // 5  Soft Landing
                  41, // 6  Standing Up
                  37, // 7  Falling Down
                  19, // 8  Hovering Down
                  15, // 9  Hovering Up
                  43, // 10 FlyingSlow
                   7, // 11 Flying
                  31, // 12 Hovering
                  13, // 13 Jumping
                  35, // 14 PreJumping
                   3, // 15 Running
                  11, // 16 Turning Right
                   9, // 17 Turning Left
                   1, // 18 Walking
                  39, // 19 Landing
                  21, // 20 Standing 1
                  23, // 21 Standing 2
                  25, // 22 Standing 3
                  27, // 23 Standing 4
                  29, // 24 Standing 5
                  47, // 25 Treading Water
                  49, // 26 Swimming
                  51, // 27 Swim up
                  43  // 28 Swim Down
                ];

// This is an ugly hack, because the standing up animation doesn't work quite right
// (SL is borked, this has been bug reported)
// If you play a pose overtop the standing up animation, your avatar tends to get
// stuck in place.
// This is a list of anims that we'll stop automatically
list autoStop = [ 5, 6, 19 ];
// Amount of time we'll wait before autostopping the animation
float autoStopTime = 1.5;

// List of stands                      
list    standIndexes    = [ 20, 21, 22, 23, 24 ];

// How long before flipping stand animations
float standTime = 40.0;

// How fast we should poll for changed anims, changed by FlipperPA to cut lag
// Changed from 0.001 to 0.25
// running at 0.001 doesn't have much benefit; it causes the server to process 1000 times a second
// 0.25 causes server to process only 4 times a second, which in a streaming environment
// should be just fine, with almost no affect noticed by the end user. The cost to the server versus
// benefit to the user is a good chance, IMHO. :-)
float timerEventLength = 0.25;

// Send a message if we encounter a state we've never seen before
integer DEBUG = TRUE;

// GLOBALS
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

list stands = [ "", "", "", "", "" ];          // List of stand animations
integer curStandIndex = 0;                     // Current stand we're on (indexed [0, numStands])
string curStandAnim = "";                      // Current Stand animation
integer numStands;                             // # of stand anims we use (constant: ListLength(stands))
integer curStandAnimIndex = 0;                 // Current stand we're on (indexed [0, numOverrides] )

list overrides = [];                           // List of animations we override
list notecardLineKey = [];                     // notecard reading keys
integer notecardLinesRead;                     // number of notecard lines read
integer numOverrides;                          // # of overrides (a constant - llGetListLength(lineNums))

string  lastAnim = "";                         // last Animation we ever played
integer lastAnimIndex = 0;                     // index of the last animation we ever played
string  lastAnimState = "";                    // last thing llGetAnimation() returned


integer animOverrideOn = TRUE;                 // Is the animation override on?
integer gotPermission  = FALSE;                // Do we have animation permissions?

integer listenHandler0;                        // Listen handlers

// CODE
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
list listReplace ( list _source, list _newEntry, integer _index ) {
    return llListInsertList( llDeleteSubList(_source,_index,_index), _newEntry, _index );
}

startNewAnimation( string _anim, integer _animIndex, string _state ) {
    if ( _anim != lastAnim ) {
        if ( _anim != "" ) {   // Time to play a new animation
            llStartAnimation( _anim );
            
            if ( _state != lastAnimState && llListFindList(stopAnimName, [_state]) != -1 ) {
                // Stop the default sit/sit ground animation
                llStopAnimation( llList2String(stopAnimName, llListFindList(stopAnimName, [_state])) );
            } 
            else if ( llListFindList( autoStop, [_animIndex] ) != -1 ) {
                // This is an ugly hack, because the standing up animation doesn't work quite right
                // (SL is borked, this has been bug reported)
                // If you play a pose overtop the standing up animation, your avatar tends to get
                // stuck in place.
                if ( lastAnim != "" ) {
                    llStopAnimation( lastAnim );
                    lastAnim = "";
                }
                llSleep( autoStopTime );
                llStopAnimation( _anim );
            }
        }
        if ( lastAnim != "" )
            llStopAnimation( lastAnim );
        lastAnim = _anim;
    }
    lastAnimIndex = _animIndex;
    lastAnimState = _state;
}

// Load all the animation names from a notecard
loadNoteCard( string _notecard ) {
    integer i;
    
    if ( llGetInventoryKey(_notecard) == NULL_KEY ) {
        llSay( 0, "Notecard '" + _notecard + "' does not exist." );
        return;
    }

    llInstantMessage( llGetOwner(), "Loading notecard '" + _notecard + "'..." );
    // Start reading the data
    notecardLinesRead = 0;
    notecardLineKey = [];
    for ( i=0; i curPos.z )
            curAnimIndex = llList2Integer( underwaterOverride, underwaterAnimIndex );
        startNewAnimation( llList2String(overrides,curAnimIndex), curAnimIndex, curAnimState );
    }
}

// Initialize listeners, and reset some status variables
initialize() {
    if ( animOverrideOn )
        llSetTimerEvent( timerEventLength );
    else
        llSetTimerEvent( 0 );
    lastAnim = "";
    lastAnimIndex = -1;
    lastAnimState = "";
    gotPermission = FALSE;
    if ( listenHandler0 )
        llListenRemove( listenHandler0 );
    listenHandler0 = llListen( LISTEN_CHANNEL, "", llGetOwner(), "" );
}

// STATE
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

default {
    state_entry() {
        integer i;
        
        if ( llGetAttached() )
            llRequestPermissions(llGetOwner(),PERMISSION_TRIGGER_ANIMATION|PERMISSION_TAKE_CONTROLS);
            
        // Initialize!
        numStands = llGetListLength( stands );
        numOverrides = llGetListLength(lineNums);
        curStandAnimIndex = llList2Integer(standIndexes,curStandIndex);

        // populate override list with blanks
        for ( i=0; i standTime ) {
                curStandIndex = (curStandIndex+1) % numStands;
                curStandAnimIndex = llList2Integer(standIndexes,curStandIndex);
                curStandAnim = llList2String(overrides, curStandAnimIndex);
                if ( lastAnimState == "Standing" )
                    startNewAnimation( curStandAnim, curStandAnimIndex, lastAnimState );
                llResetTime();
            }
        }
    }
}