User:Cow Taurog/Name to key

From Second Life Wiki
< User:Cow Taurog
Revision as of 00:44, 14 March 2009 by Cow Taurog (talk | contribs) (New page: 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 th...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

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).

<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> // example interface 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>