Difference between revisions of "User:Cow Taurog/Name to key"

From Second Life Wiki
Jump to: navigation, search
 
Line 1: Line 1:
This script will listen on any number/channel for a link message with "resolvename" as the string, and "User Name" (a real name of course, not User Name) as the id. It will then resolve the UUID of that person using the <span class="plainlinks">[http://www.alpha-fox.com/name2key alpha fox name to key service], and send a link message back on the same number/channel with "resolvedkey" as the string, and the user's UUID as the id. This service may not be around forever, and the script is subject to breakage should it no longer exist ([http://www.alpha-fox.com/donate/ donations] are good</span>).  
+
This script will listen on any number/channel for a link message with "resolvename" as the string, and "User Name" (a real name of course, not User Name) as the id. It will then resolve the UUID of that person using the <span class="plainlinks">[http://www.alpha-fox.com/name2key alpha fox name to key service], and send a link message back on the same number/channel with "resolvedkey" as the string, and the user's UUID as the id. This service may not be around forever, and the script is subject to breakage should it no longer exist ([http://www.alpha-fox.com/donate/ donations] are good</span>). Place the first script, and then one of the example scripts below in the same prim, then touch to use it.
  
 
<lsl>
 
<lsl>

Latest revision as of 17:25, 2 April 2009

This script will listen on any number/channel for a link message with "resolvename" as the string, and "User Name" (a real name of course, not User Name) as the id. It will then resolve the UUID of that person using the alpha fox name to key service, and send a link message back on the same number/channel with "resolvedkey" as the string, and the user's UUID as the id. This service may not be around forever, and the script is subject to breakage should it no longer exist (donations are good). Place the first script, and then one of the example scripts below in the same prim, then touch to use it.

<lsl> string gsURL="http://name2key.alpha-fox.com/?name="; key httpRequestId; integer giComm;

default{

   link_message(integer sender,integer num,string mess,key id){if(mess=="resolvename"){
       giComm=num;
       httpRequestId=llHTTPRequest(gsURL+llEscapeURL(id),[],"");
   }}
   http_response(key request_id,integer status,list metadata,string body){if(request_id==httpRequestId){
       llMessageLinked(LINK_SET,giComm,"resolvedkey",llUnescapeURL(body));
       llResetScript();
   }}

} </lsl>
<lsl> // get key by touch default{

   touch_start(integer num){llMessageLinked(LINK_SET,1,"resolvename",llDetectedName(num-1));
   link_message(integer sender,integer num,string mess,key id){if(mess=="resolvedkey"){llOwnerSay(id);}}

} </lsl>
<lsl> // get key by chat default{

   touch_start(integer num){if(llDetectedKey(num-1)==llGetOwner()){llOwnerSay("Say the full name of the avatar you would like to find the UUID for over public chat, or /20.");llListen(0,"",llGetOwner(),"");llListen(20,"",llGetOwner(),"");}}
   listen(integer chan,string name,key id,string mess){llMessageLinked(LINK_SET,1,"resolvename",mess);}
   link_message(integer sender,integer num,string mess,key id){if(mess=="resolvedkey"){llOwnerSay(id);llResetScript();}}

} </lsl>