-->

FoxSan's 3D Tools and LSL Script Repository

Tons of LSL scripts, examples and 3D tools, free for all. There are currently 207 scripts and articles in this database.

Stay In Sim

//This script makes sure that your objects stay in the sim that they are created. You can't save an object to inventory and rez in in another sim while this script is active.
 
123//remove the 123 to be able to use this script. Just delete the numbers and make sure running in the lower left is checked and hit save.
 
//Make sure you save a copy of this script and all others in this package before removing the 123.default
 
{
    state_entry()
    {
        llSetStatus(STATUS_DIE_AT_EDGE,TRUE);
        vector INITCorner = llGetRegionCorner();
        while(TRUE)
        {
            if(llGetRegionCorner() != INITCorner)
            {
                llDie();
            }
        }
    }
}

Walking Sound

default
{
    state_entry()
    {
        llStopSound();
        llSetTimerEvent(0.001);
    }
 
    timer()
    {
        if (llGetAgentInfo(llGetOwner()) & AGENT_WALKING)
        {
            state walking;
        }
    }
}
state walking
{
    state_entry()
    {
        llLoopSound(llGetInventoryName(INVENTORY_SOUND,0),3);
    }
    timer()
    {
        if (!(llGetAgentInfo(llGetOwner()) & AGENT_WALKING))
        {
            state default;
        }
    }
}

Final Flight 2.2

float speed=10000;
 
default
{
    attach(key on)
    {
        if (on != NULL_KEY)
        {
            llListen(0,"",llGetOwner(),"");
            integer perm = llGetPermissions();
            if (perm != (PERMISSION_TAKE_CONTROLS))
            {
                llRequestPermissions(on, PERMISSION_TAKE_CONTROLS);
            }
            else
            {
                llTakeControls(CONTROL_FWD , TRUE, TRUE);
            }
        }
    }
 
    listen(integer channel, string name, key id, string m)
    {
        list test = llCSV2List(m);
        if(llGetListLength(test)==2&&llList2String(test,0)=="speed")
            speed=llList2Float(test,1);
    }
 
    run_time_permissions(integer perm)
    {
        if (perm)
        {
            llTakeControls(CONTROL_FWD, TRUE, TRUE);
        }
    }
 
    control(key owner, integer level, integer edge)
    {
        if (!(level & CONTROL_FWD) || !(llGetAgentInfo(llGetOwner())&AGENT_FLYING))
        {
            llSetForce(<0,0,0>, FALSE);
        }
        else
        {
            vector fwd= llRot2Fwd(llGetRot());
            fwd = llVecNorm(fwd);
            fwd *= speed;
            llSetForce(fwd, FALSE);
        }
    }
 
}

Ear Control

integer l1;
integer x;
integer earflick;
integer earsdown;
vector rot;
default
{
    on_rez(integer start_param)
    {
        if(l1!=0)
            llListenRemove(l1);
        l1=llListen(1,"",llGetOwner(),"");
        if(earflick==TRUE)
        {
            llSetTimerEvent(2+llFrand(8));
        }
        else
        {
            llSetTimerEvent(0);
        }
    }
 
    state_entry()
    {
        if(l1!=0)
            llListenRemove(l1);
        l1=llListen(1,"",llGetOwner(),"");
    }
 
    listen(integer channel, string name, key id, string msg)
    {
        msg=llToLower(msg);
        if(msg=="ears up"||msg=="earsup")
        {
            llSetLocalRot(<-0.29028, 0.00000, 0.00000, 0.95694>);
            earsdown=FALSE;
        }
        else if(msg=="ears down"||msg=="earsdown")
        {
            llSetLocalRot(<-0.65903, 0.25628, 0.70694, 0.01542>);
            earsdown=TRUE;
        }
        else if(msg=="earflick on"||msg=="eartwitch on")
        {
            earflick=TRUE;
            llSetTimerEvent(2+llFrand(8));
        }
        else if(msg=="earflick off"||msg=="eartwitch off")
        {
            earflick=FALSE;
            llSetTimerEvent(0);
        }
    }
 
    timer()
    {
        if(earsdown==FALSE)
        {
            for(x=0; x < 4; x++)
            {
                rot=llRot2Euler(llGetLocalRot());
                rot.z=rot.z + 0.1;
                rot.x=rot.x - 0.05;
                llSetLocalRot(llEuler2Rot(rot));
                llSleep(0.01);
            }
            for(x=0; x < 4; x++)
            {
                rot=llRot2Euler(llGetLocalRot());
                rot.z=rot.z - 0.1;
                rot.x=rot.x + 0.05;
                llSetLocalRot(llEuler2Rot(rot));
                llSleep(0.01);
            }
        }
        llSetTimerEvent(2+llFrand(8));
    }
}