User:LindaB Helendale/Name2Key
Jump to navigation
Jump to search
| LSL Portal | Functions | Events | Types | Operators | Constants | Flow Control | Script Library | Categorized Library | Tutorials |
Simple name2key script to find the key of an avatar.
Usage: /1 firstname surname
To use with the LindaBeamArray object scanner, get the key with this script and use search keyword /key <user key> instead of /owner <user name>
<lsl>
// Name2key using w-hat service
// Usage: /1 firstname surname
integer CMDCHANNEL=1;
key reqid; string NAME;
default {
state_entry()
{
llListen(CMDCHANNEL,"",llGetOwner(),"");
}
listen( integer channel, string name, key id, string message)
{
string URL = "http://w-hat.com/name2key"; // name2key url
NAME=message;
reqid = llHTTPRequest( URL + "?terse=1&name=" +
llEscapeURL(NAME), [], "" );
}
http_response(key id, integer status, list meta, string body) {
if ( id != reqid )
return;
if ( status == 499 )
llOwnerSay("name2key request timed out");
else if ( status != 200 )
llOwnerSay("the internet exploded!!");
else if ( (key)body == NULL_KEY )
llOwnerSay("No key found for " + NAME);
else
llOwnerSay(NAME + " Key: " + body );
}
} </lsl>