Sneakin

From Second Life Wiki
Jump to: navigation, search

Theme music when you walk/run/crouchwalk

--BETLOG Hax UTC+10: 20090810 0403 [SLT: 20090809 1103]

// BETLOG Hax
// UTC+10: 20090728 0733 [SLT: 20090727 1433]
// Was Messamo House's script, which he may have copy pasted from Hen Streeter or vice versa, but i *totally* rewrote it.. TOTALLY
// https://wiki.secondlife.com/wiki/Sneakin
//----------------------------------
//        **** LICENCE START ****
// http://creativecommons.org/licenses/by-sa/3.0/
//             Attribution licence:
// You must:
//    -Include this unaltered licence information.
//    -Supply my original script with your modified version.
//    -Retain the original scripts' SL permissions. [+c/+m/+t]
// Or:
//    -Link to the wiki URL from which you copied this script.
//    -Document: "Uses parts of <scriptname> by BETLOG Hax"
//        **** LICENCE END ****
//----------------------------------
key     gMode            = NULL_KEY;
default
{   state_entry()
    {   llStopSound();
        llSetTimerEvent(0.333333);
    }
    timer()
    {   integer i = llGetAgentInfo(llGetOwner());
        key mode=NULL_KEY;
        if(i & AGENT_WALKING)
        {   if(llVecMag(llList2Vector(llGetObjectDetails(llGetOwner(), ([OBJECT_VELOCITY])),0))>4.0)
                mode="770cf677-5fda-56fe-85dd-ee1f07c63005";//run
            else if(i & AGENT_CROUCHING)
                mode="f7db8364-4369-712f-f034-92799ee26193";//crouch
            else
                mode="cc493463-b22d-cf0f-49ef-285e641a87f4";//walk
        }
        if(gMode!=mode)
        {   gMode=mode;
            llStopSound();        
            if(mode!=NULL_KEY)
                llLoopSound(mode, 1.0);
        }
    }
}
//----------------------------------