User:Cow Taurog/Language scanner

From Second Life Wiki
Jump to navigation Jump to search

Announces any nearby avatar, and their ISO 639-1 language code. <lsl> // This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License // // Commercial use is allowed. // 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>