-->

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.

Avatar Scanner

// Bromley College
// Linden Script Exhibition
 
// Code for Step 32 Poster
 
default
{
    touch_start(integer total_number)
    {
        llSensor("", NULL_KEY, AGENT, 96, PI);
        // Scan for all avatars (AGENT) with any name ("") and any id (NULL_KEY) within 96 metres (the maximum scan range) in all directions (PI). If any avatars are detected create an indexed list of them and raise a sensor() event.
    }
 
    sensor(integer total_number)
    // The sensor event is raised when avatars are detected. The number of detected avatars is passed to the script below in the parameter total_number.
 
    {
        llWhisper(0, (string)total_number + " avatar(s) detected" );
        // The following 'for' loop  works through the indexed list created by the llsensor() function and the outputs the name and key of each detected avatar on ch0 in turn.
 
        integer i;
        for (i = 0; i < total_number; i++)
        {
            llWhisper(0, "Avatar name: " + llDetectedName(i) + " Avatar Key: " + (string)(llDetectedKey(i)));
 
        //Given an avatar's detected object number the llDetectedName function gets the avatar's name and the llDetectedKey function gets the avatar's key.  
 
        }
    }
}
 
// End of code;

llGetRegionAgentCount

default
{
    state_entry()
    {
        llSetTimerEvent(15.0);
    }
 
    timer()
    {
        llSetText("Agents in Region: " + (string)llGetRegionAgentCount(), <1.0, 1.0, 1.0>, 1.0);
    }
}

llDetectedGroup

default
{
    state_entry()
    {
        llSetText("llDetectedGroup()\nTouch to see if you're in the same group",<1,1,1>,1);
    }
 
    touch_start(integer total_number)
    {
       if(llDetectedGroup(0))
            llSay(0,"Same group!");
       else
            llSay(0,"Not the same group!");
    }
}

llDetectedKey

default
{
    state_entry()
    {
        llSetText("llDetectedKey()\nTouch to detect key",<1,1,1>,1);
    }
 
    touch_start(integer total_number)
    {
      llSay(0,llDetectedKey(0));
    }
}

llDetectedName

default
{
    state_entry()
    {
        llSetText("llDetectedName()\nTouch to detect name",<1,1,1>,1);
    }
 
    touch_start(integer total_number)
    {
      llSay(0,llDetectedName(0));
    }
}