Lindens Rider Linden Posted April 20, 2018 Lindens Share Posted April 20, 2018 (edited) Hi there, I'd like to take a moment to announce two new script function that we here at the lab are just putting into testing on the Beta Grid(Aditi) and that will roll out to the main grid in the coming weeks. llName2Key and llRequestUserKey. These functions will provide the UUID of a named avatar. llName2Key only works for agents that are either in the region that the script is running on, llRequestUserKey will work for any agent on the grid. Documentation on these functions is on the Second Life wiki. Here: llName2Key and here: llRequestUserKey. They are available for testing on the beta grid (Aditi) in the following regions: Sylveon, Umbreon, Leafeon and Mystic Lane Sample Usage integer chat_handle = 0; list events; integer STRIDE = 2; default { state_entry() { llSetTextureAnim(ANIM_ON|LOOP, ALL_SIDES, 5, 5, 0, 23, 20.0); chat_handle = llListen(1, "", llGetOwner(), ""); } listen( integer channel, string name, key id, string message) { llSay(0, "Checking for \"" + message + "\""); llSay(0, "llName2Key = " + (string)llName2Key(message)); if (llGetOwner() != id) { llSay(0, "No dataserver lookup for you!"); return; } events += [ llRequestUserKey(message), message ]; } dataserver(key request_id, string data) { integer index = llListFindList(events, [ request_id] ); if (~index ) { string name = llList2String(events, index + 1); llSay(0, "Dataserver \"" + name + "\" = " + data ); events = llDeleteSubList(events, index, index + STRIDE - 1); } } } A quick afterward for people who were at the user group meetings: Please note the name change. Edited April 20, 2018 by Rider Linden 3 3 Link to comment Share on other sites More sharing options...
Xiija Posted April 20, 2018 Share Posted April 20, 2018 (edited) copy / pasted this... llRequestUserKey works good, llName2Key gives an error... "name not defined within scope" @aditi - Sylveon - secondlife://util.aditi.lindenlab.com/secondlife/Sylveon/131/132/23 on RequestUserKey wiki page.. typo: owner_name_query should be name_key_query Edited April 20, 2018 by Xiija 1 Link to comment Share on other sites More sharing options...
Lindens Rider Linden Posted April 20, 2018 Author Lindens Share Posted April 20, 2018 (edited) 3 minutes ago, Xiija said: llName2Key gives an error... "name not defined within scope" I'm still updating the region. (give me 5 more minutes.) Edited April 20, 2018 by Rider Linden Link to comment Share on other sites More sharing options...
Lindens Rider Linden Posted April 20, 2018 Author Lindens Share Posted April 20, 2018 The new code is running on the regions now. Thank you for your patience. 1 Link to comment Share on other sites More sharing options...
Xiija Posted April 21, 2018 Share Posted April 21, 2018 Workin good, Thank You for the new functions Link to comment Share on other sites More sharing options...
Ruthven Ravenhurst Posted May 21, 2018 Share Posted May 21, 2018 Somethiing I noticed today. I first tried llName2Key on an agent I knew wasn't in the region, as it's an old friend that hasn't been online in years. Of course it returned NULL_KEY Then I used llRequestUserKey for the same name. Then when I used llName2Key again, it returned the actual UUID. Thinking maybe it just kept it in the script's memory somewhere (not as a variable) I tried it with 2 seperate scripts. Same thing, it still had the key available for another script only calling llName2Key. Decided to try again on a different name. First called llName2Key, returned NULL_KEY, seperate object and script, called llRequestUserKey, got the UUID, called llName2Key again, got uuid. I suppose the data server temporarily saves that in the sim's script memory for other scripts to be able to call it? How long? would be be of any use? How long does after an avatar leaves the sim can llName2Key return the UUID? Link to comment Share on other sites More sharing options...
Lindens Rider Linden Posted May 21, 2018 Author Lindens Share Posted May 21, 2018 Your observations are correct. llName2Key does a fast check against the agent name cache on the simhost. If the agent's name is not found the function returns NULL immediately. llRequestUserKey does a (potentially) longer lookup for the agent's name and may hit the user database in the process. When llRequestUserKey gets a response the name and UUID are added to the name cache for the region, so a subsequent llName2Key will in fact find a valid response to return. You should make no assumptions about the length of time a user's record will remain cached other than it will be kept as long as the agent is physically in the region, and for a short time after they have left. It will also be cached briefly following a call to llRequestUserKey. Note: Because of this behavior, llName2Key is not a reliable way to determine if a user is actually present in the region. 1 1 Link to comment Share on other sites More sharing options...
Lucia Nightfire Posted May 21, 2018 Share Posted May 21, 2018 Rider, can you please update the wiki page for llName2Key() outlining that behavior? Thanks. 1 Link to comment Share on other sites More sharing options...
Arron Rainfall Posted June 4, 2018 Share Posted June 4, 2018 On 5/21/2018 at 4:14 PM, Lucia Nightfire said: Rider, can you please update the wiki page for llName2Key() outlining that behavior? Thanks. Also, this caveat on the llKey2Name page should probably be removed: There is no opposite function (llName2Key) available. However, there are third-party websites which can be queried using the llHTTPRequest function and the http_response event. 2 Link to comment Share on other sites More sharing options...
Arduenn Schwartzman Posted June 12, 2018 Share Posted June 12, 2018 I just want to say thanks for this to the SL devs behind this. It's a much-needed function set. I'm pretty sure many creators are very pleased they don't have to communicate with and rely on third-party username/UUID databases (some with shady reputations) anymore. 1 1 Link to comment Share on other sites More sharing options...
Rolig Loon Posted June 12, 2018 Share Posted June 12, 2018 On 6/4/2018 at 6:25 PM, Arron Rainfall said: Also, this caveat on the llKey2Name page should probably be removed: There is no opposite function (llName2Key) available. However, there are third-party websites which can be queried using the llHTTPRequest function and the http_response event. Done. Links to third-party services have been retained in the Notes section of that page for those who still need that information. 2 Link to comment Share on other sites More sharing options...
Recommended Posts
Please take a moment to consider if this thread is worth bumping.
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now