Difference between revisions of "User:Cow Taurog/Language scanner"

From Second Life Wiki
Jump to: navigation, search
(update script to include license info)
Line 1: Line 1:
Tells the owner who is nearby, and their <span class="plainlinks">[http://en.wikipedia.org/wiki/List_of_ISO_639-1_codes ISO 639-1]</span> language code.
+
Announces any nearby avatar, and their <span class="plainlinks">[http://en.wikipedia.org/wiki/List_of_ISO_639-1_codes ISO 639-1]</span> language code.
 
<lsl>
 
<lsl>
 +
// This text is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 United States License.
 +
// http://creativecommons.org/licenses/by-nc-sa/3.0/
 +
// Resale, or other commercial use is prohibited.
 +
// Modification and/or distribution is allowed, as long as attribution for each revision is given, and the same license is used.
 +
//
 +
// Cow Taurog's language code finder, v1.0
 +
//
 +
// This script will say the name of every avatar in range (including you), and their detected ISO 639-1 language code when touched.
 +
// Feel free to use, reuse, or change the code, as long as you abide by the license
 +
//
 +
list lD; // stores detected avatars/languages
 +
integer i; // loops through detected avatars
 
default{
 
default{
     state_entry(){
+
     touch_start(integer num){ // when touched...
         llSensor("","",AGENT,96,PI);
+
         llSensor("","",AGENT,96,PI); // scan for any avatar within range
 
     }
 
     }
     touch_start(integer num){
+
     sensor(integer num){ // if one or more avatars are found...
         llSensor("","",AGENT,96,PI);
+
         for(i=0;i<num;i++){ // for each avatar found...
    }
+
            lD=lD+[llDetectedName(i)+": "+llGetAgentLanguage(llDetectedKey(i))]; // add the name and language to the list
    sensor(integer num){
+
        }
        llOwnerSay(llDetectedName(num-1)+", "+llGetAgentLanguage(llDetectedKey(num-1)));
+
        llSay(0,"\n"+llDumpList2String(lD,"\n")); // say names and their language code over public chat
    }
+
         llResetScript(); // reset the script for the next use
    no_sensor(){
+
         llOwnerSay("No more avatars found.");
+
 
     }
 
     }
 
}
 
}
 
</lsl>
 
</lsl>

Revision as of 02:46, 17 August 2011

Announces any nearby avatar, and their ISO 639-1 language code. <lsl> // This text is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 United States License. // http://creativecommons.org/licenses/by-nc-sa/3.0/ // Resale, or other commercial use is prohibited. // Modification and/or distribution is allowed, as long as attribution for each revision is given, and the same license is used. // // Cow Taurog's language code finder, v1.0 // // This script will say the name of every avatar in range (including you), and their detected ISO 639-1 language code when touched. // Feel free to use, reuse, or change the code, as long as you abide by the license // list lD; // stores detected avatars/languages integer i; // loops through detected avatars default{

   touch_start(integer num){ // when touched...
       llSensor("","",AGENT,96,PI); // scan for any avatar within range
   }
   sensor(integer num){ // if one or more avatars are found...
       for(i=0;i<num;i++){ // for each avatar found...
           lD=lD+[llDetectedName(i)+": "+llGetAgentLanguage(llDetectedKey(i))]; // add the name and language to the list
       }
       llSay(0,"\n"+llDumpList2String(lD,"\n")); // say names and their language code over public chat
       llResetScript(); // reset the script for the next use
   }

} </lsl>