Difference between revisions of "Key2Name"

From Second Life Wiki
Jump to navigation Jump to search
(:))
m (Replaced <source> with <syntaxhighlight>)
 
(5 intermediate revisions by 3 users not shown)
Line 1: Line 1:
{{LSLC|Library}}
{{LSL Header}}{{LSLC|Library}}


== Black DB Key2Name ==
{{LSL Function/warning|inline=*|Dead Service|The web service this script utilized is no longer available. The URL has been removed as the domain is now being used as a phishing site. This article exists for historical interest.}}
Can also use [http://www.blackclan.net/ Black DB Name2Key Website] and use the Live name search.


== llName2Key Script ==
== llName2Key Script ==
 
<syntaxhighlight lang="lsl2">
<lsl>
string black_db_key2name_service = "";
string black_db_key2name_service = "http://blackclan.net/name2key/k2n.php?q=";
key QID;
key QID;
   
   
Line 22: Line 20:
     state_entry()
     state_entry()
     {
     {
         llListen(0, "", llGetOwner(), "");
         llListen(PUBLIC_CHANNEL, "", llGetOwner(), "");
     }
     }
     listen(integer channel, string name, key id, string str)
     listen(integer channel, string name, key id, string str)
Line 34: Line 32:
         {
         {
             Name = llStringTrim(body, STRING_TRIM);
             Name = llStringTrim(body, STRING_TRIM);
             if(llStringLength(Name) == 0)
             if(!llStringLength(Name))// if the length is zero
             {
             {
                 //None found
                 //None found
Line 44: Line 42:
         }
         }
     }
     }
}</lsl>
}</syntaxhighlight>
 
==See Also==
==See Also==
[[Who]]
* {{LSLGC|Avatar/Name}} - Name related functions.
* [[Who]]

Latest revision as of 12:24, 16 January 2023


Emblem-important-red.png Dead Service Warning!

The web service this script utilized is no longer available. The URL has been removed as the domain is now being used as a phishing site. This article exists for historical interest.

llName2Key Script

string black_db_key2name_service = "";
key QID;
 
string Name;
key UUID;
 
llGetKey2Name(key UUID)
{
    QID = llHTTPRequest(black_db_key2name_service+llEscapeURL((string)UUID), [], "");
}
 
default
{
    state_entry()
    {
        llListen(PUBLIC_CHANNEL, "", llGetOwner(), "");
    }
    listen(integer channel, string name, key id, string str)
    {
        UUID = id;
        llGetKey2Name(UUID);
    }
    http_response(key req, integer status, list meta, string body)
    {
        if(req == QID && status == 200)
        {
            Name = llStringTrim(body, STRING_TRIM);
            if(!llStringLength(Name))// if the length is zero
            {
                //None found
            }
            else
            {
                llOwnerSay((string)UUID + "'s name = "+Name);
            }
        }
    }
}

See Also