-->

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.

Land Filler

//After yesterdays "ultra lag" attack, We need to fill up our parcels so that they can't rez too many items and crash the sim.
 
//The concept is simple, replicate until fail and then delete x copys.
 
//I'll leave a full permission copy at yadni's junkyard.
 
//Note: The prim names must be exact.
 
//1. Go to a far away area or up high so that this does not cause lag.
//2. Create a blank, white, "Full bright" prim and name it "Land_Fill"
//3. Place the "Land_Fill_Die" script into the prim.
//4. Take it.
//5. Create a blank, white, "Full bright" prim and name it "Land_Filler"
//6. Place the "Rez_Array" script into the prim named "Land_Filler"
//7. Place "Land_Fill" into "Land_Filler"
//8. Enter 20 into the description field of "Land_Filler" to leave space for 20 prims.
//9. Touch it twice. The first touch clears out any leftovers.
 
//------------------------
 
// Rez to fill property - (description count)
// Released into the public domain by Grumble Loudon and LaserFur Leonov
 
//Rez and then touch to either rez or kill
 
//Note, The land max is not updated imedietly, so there will be a little
// time while no objects can be rezed.
 
integer m_RezLimit = 16384; //limit the number of prims created, just in case.
 
// you could also set this if you are on rented land and don't want to go over your limit.
 
integer m_channel = 25626;
 
list    m_OwnerNames = []; //Add other owner names here for groups.
 
//**************************************************  ************************************
integer m_RezNotKill = TRUE;
integer m_RezCount = 0;
vector  m_RezPos;
integer m_RezTimeout =0;
default
{
    state_entry()
    {
        m_OwnerNames += llKey2Name(llGetOwner());  // assumes owner is online when he rezes it
        llSetStatus(STATUS_BLOCK_GRAB, TRUE); //needed if we add a touch start
    }
    //**************************************************  ***********************************
    on_rez(integer StartPram)
    {
        llResetScript();
    }//on rez
    //**************************************************  ************************************
    touch_start(integer total_number)
    {
        key DetKey = llDetectedKey(0);
        string DetName = llKey2Name(DetKey);
 
        //owner info
        list FindName;
        FindName += DetName;   //name of avitar
        if (llListFindList( m_OwnerNames,  FindName) == -1) //not an owner
        {
            m_RezNotKill = !m_RezNotKill;  //toggle
 
            if (m_RezNotKill)
            {                   //Rez
                llOwnerSay("Starting");
                m_RezCount = 1;
                m_RezPos = llGetPos();
                m_RezPos.z += 0.5;
                llRezObject("Land_Fill",m_RezPos,<0,0,0>,<0,0,0,1>,m_RezCount); //start process
                m_RezTimeout = 0;
                llSetTimerEvent(1);
            }else{
                llOwnerSay("Killing all");
                llSay(m_channel,"2147483647");  //kill all
            };//if m_RezNotKill
        };// if owner
    }// touch_start
//**************************************************  ************************************
    object_rez(key id)// it worked. So there may be more prim space left
    {
        m_RezTimeout = 0;       //reset timeout
 
        if (m_RezNotKill)     //check just in case a touch canceled the rez
        {
            ++m_RezCount;           //next number
            if (m_RezCount < m_RezLimit)
            {
                llRezObject("Land_Fill",m_RezPos,<0,0,0>,<0,0,0,1>,m_RezCount); //do it again
            };
            llSetTimerEvent(1);         //just in case a lag caused a timeout and a then a Rez
        };
    } //object_rez
      //**************************************************  ************************************
    timer()
    {
        ++m_RezTimeout;
        if (m_RezTimeout > 5)      //rez failed so parcel is full
        {
            llSay(m_channel,llGetObjectDesc());  //kill x number
            llSetTimerEvent(0);                  //kill timer
            llOwnerSay("Done");
        };
    }//timer
}//

llGetLinkName

default
{
    state_entry()
    {
        llSetText("llGetLinkName test\nTouch to retrieve the name of each prim in the set.", <1,1,1>, 1);
    }
 
    touch_start(integer total_number)
    {
       integer links = 7;
        while (links > -1)
        {
           llSay(0, llGetLinkName(links) + " is link: " + (string)links);
           --links;
        }
    }
}

llGetCreator

default
{
    state_entry()
    {
        llSetText("llGetCreator test.\nClick to grab creator key.", <1,1,1>, 1.0);
    }
 
    touch_start(integer total_number)
    {
        llSay(0, "Creator: " + (string)llGetCreator());
    }
}

llMessageLinked

default
{
    state_entry()
    {
        llSetText("llMessageLinked()\nTouch to send myself a link message",<1,1,1>,1);
    }
 
    touch_start(integer total_number)
    {
        llMessageLinked(LINK_SET, 0, "The llama (Lama glama) is a South American camelid, widely used as a pack animal by the Incas and other natives of the Andes mountains.", NULL_KEY);
    }
 
    link_message(integer sender_num, integer num, string str, key id)
    {
        llSay(0, str);
    }
}

Give Object And Play Sound

// This script will give out a object from Inventory and play sound file when click on.
 
string object_name = "object";
integer i;
 
default
{
    state_entry()
    {
        llPreloadSound(llGetInventoryName(INVENTORY_SOUND, 0));
 
    }
     touch_start(integer total_number)
    {
         integer i;
        key giver;
        // add a wave that is name sound.wav
        llPlaySound("pour", 1.0);
        giver = llDetectedKey(0);
        string name = llDetectedName(0);
        if (giver != NULL_KEY)
        {
            llGiveInventory(giver, object_name);
        }
 }
}