Difference between revisions of "User:Aaaloha Catnap"

From Second Life Wiki
Jump to: navigation, search
(Created page with 'Here is my radar script, scans for language and activity. put it in a hud and wear it. // original av scan script by Ordinal Malaprop // Modified by Kerian Bunin // Global list...')
 
m (took the liberty to add <lsl> tags, please undo if unwanted)
 
Line 1: Line 1:
 
Here is my radar script, scans for language and activity. put it in a hud and wear it.
 
Here is my radar script, scans for language and activity. put it in a hud and wear it.
  
 
+
<lsl>
 
// original av scan script by Ordinal Malaprop
 
// original av scan script by Ordinal Malaprop
 
// Modified by Kerian Bunin
 
// Modified by Kerian Bunin
Line 125: Line 125:
 
         if (llDetectedKey(0) == llGetOwner()) state default;
 
         if (llDetectedKey(0) == llGetOwner()) state default;
 
     }
 
     }
}
+
}</lsl>

Latest revision as of 09:27, 26 November 2009

Here is my radar script, scans for language and activity. put it in a hud and wear it.

<lsl> // original av scan script by Ordinal Malaprop // Modified by Kerian Bunin // Global list of people here at previous scan list gHere = []; // Modified by Aaaloha so it scans for acitivity /sitters quitters and language. list languageCodes = [ "zh-CN", "zh-TW", "hr", "bg", "be", "ca", "af", "sq", "ar",

"tl", "fr", "gl", "fi", "en", "et", "cs", "da", "nl",

"id", "ga", "it", "hi", "hu", "is", "de", "el", "iw",

"mt", "no", "fa", "lt", "mk", "ms", "ja", "ko", "lv",

"sl", "es", "sw", "ru", "sr", "sk", "pl", "pt-PT", "ro",

"yi", "", "en-US", "uk", "vi", "cy", "sv","th", "tr"];


default {

   on_rez(integer reset)
   {
       llResetScript();
   }
   state_entry()
   {
       llOwnerSay("avscanner initialized");
       // Clear any text hanging around
       llSetText("", <0,1,0>, 1.0);
       llSetAlpha(1.0, ALL_SIDES);
       // Start a sensor for agents within 20m
       llSensorRepeat("", NULL_KEY, AGENT, 100, PI, 1);
   }

   no_sensor()
   {
       // If nobody is detected, everyone has left
       // Go through old list and say that everyone on it has gone
       llSetText("", <0,1,0>, 1.0);
       if (gHere != []) {
           integer f;
           integer c = llGetListLength(gHere);
           for (f=0; f<c; f++) { // go through old list
               //llOwnerSay(llList2String(gHere, f) + " has left chat range");
           }
           gHere = [];
       }
   }

   sensor(integer total_number)
   {
       integer f;
       string name = "";
       string display = "";
       list here = [];
       string status = "";
       integer info = 0;
       vector myPos = llGetPos();
       // Make a list of people who are within range
       for (f=0; f<total_number; f++) {
           name = llDetectedName(f)+", "+llGetAgentLanguage(llDetectedKey(f));
           here += name;
           info = llGetAgentInfo(llDetectedKey(f));
           status = "";
           if (info & AGENT_AWAY) status += " (AWAY)";
           if (info & AGENT_SITTING) status += " (SITS)"; 
           if (info & AGENT_BUSY) status += " (BUSY)";
           if (info & AGENT_TYPING) status += " (TYPING)";
          display += name + " @ " + (string)llRound(llVecDist(llDetectedPos(f), myPos)) + "m" + status + "\n"; 
           //if (llListFindList(gHere, [name]) == -1) llOwnerSay(name + " has entered chat range");
       }
       // Now check to see if anyone has left,
       // based on the list from the last scan
       here = llListSort(here, 1, TRUE); // sort list
       integer c = llGetListLength(gHere);
       if (here != gHere) { // if new list not the same as old one
           for (f=0; f<c; f++) { // go through old list
               name = llList2String(gHere, f);
               // If anyone on old list is not on new list,
               // say that they have left
              // if (llListFindList(here, [name]) == -1) llOwnerSay(name + " has left chat range");
           }
       }
       // Update old list variable
       gHere = here;
       // Display the people who are here now
       llSetText(display, <0,1,0>, 3.0);
   }

   touch_start(integer n)
   {
       // Turn it off when touched by owner
       if (llDetectedKey(0) == llGetOwner()) state dormant;
   }

}

state dormant {

   state_entry()
   {
       llOwnerSay("Daisy's av-scanner deactivated");
       llSetText("", <0,0,0>, 1.0);
       gHere = [];
   }

   touch_start(integer n)
   {
       // Turn it back on if touched by owner
       if (llDetectedKey(0) == llGetOwner()) state default;
   }

}</lsl>