Agent Information

// Bromley College 
// Linden Script Exhibition
 
// Code for Step 33 Poster
 
default
{
   touch_start(integer total_number)
   {
       llSensor("", NULL_KEY, AGENT, 96, PI);
       // Scan for all agents (AGENT) with any name ("") and any id (NULL_KEY) within 96 metres (the maximum scan range) in all directions (PI). If any agents are detected create an indexed list of them and raise a sensor() event.
   }
 
   sensor(integer total_number)
   // The number of detected agents is passed to the script below in the parameter total_number.
 
   {
       // The following 'for' loop  works through the list created by the llsensor() function and the outputs information on each detected agent in turn.
 
    integer i;
       for (i = 0; i < total_number; i++)
       {
        if (llGetAgentInfo(llDetectedKey(i)) & AGENT_AWAY)
      // The llGetAgentInfo()function here checks to see if the detected agent (specified by their key) is in "away" mode.    
 
       {
               llSay(0, llDetectedName(i) + " is away.");
           }
 
    if (llGetAgentInfo(llDetectedKey(i)) & AGENT_CROUCHING)
           {
               llSay(0, llDetectedName(i) + " is crouching");
           }
 
    if (llGetAgentInfo(llDetectedKey(i)) & AGENT_FLYING)
           {
               llWhisper(0, llDetectedName(i) + " is flying.");
           }
 
    if (llGetAgentInfo(llDetectedKey(i)) & AGENT_IN_AIR)
           {
               llWhisper(0, llDetectedName(i) + " is hovering.");
           }
 
    if (llGetAgentInfo(llDetectedKey(i)) & AGENT_MOUSELOOK)
           {
               llWhisper(0, llDetectedName(i) + " is in mouselook.");
           }
 
    if (llGetAgentInfo(llDetectedKey(i)) & AGENT_ON_OBJECT)
           {
               llWhisper(0, llDetectedName(i) + " is sitting on an object.");
           }
 
    if (llGetAgentInfo(llDetectedKey(i)) & AGENT_TYPING)
           {
               llWhisper(0, llDetectedName(i) + " is typing.");
           }
 
    if (llGetAgentInfo(llDetectedKey(i)) & AGENT_WALKING)
           {
               llWhisper(0, llDetectedName(i) + " is walking.");
           }
        }
    }
}
 
// End of code;

 

Flash Scratch to SL - Your Scripting Tool

Script ImageNeed to write a LSL script and don't know how to script?  I know I hate trying to get my head around LSLS when I an in a time crunch. So why not give Flash Scratch a try! Its a great tool for learning and scoding your own scripts for Second Life without having to pay someone to do it and without a crash course in LSL

A Huge thanks to John Bennet of ATLAS Institute at University of Colorado and Eric Rosenbaum at MIT for writing Scratch for SL to begin with.

Read more: Flash Scratch to SL - Your Scripting Tool