Jump to content
Isolte Ember

How can I check if a UUID from a list is a Group vs an Avatar?

Recommended Posts

I'd like to use the URI name space to print a list of individual Avatar and Group profile links to chat from a notecard of supplied UUIDs (up to at least 20 individual UUIDs with the possibility of more), but I'm having trouble figuring out how to test if a UUID is an Avatar or if it is a Group. Below is the simplest general idea of what I need. (I've already got the dataserver event figured out so it reads the notecard lines and puts them in a list. 

if (UUID == isAgent)
llOwnerSay("secondlife:///app/agent/" + (string)UUID + "/about");

else
llOwnerSay("secondlife:///app/group/" + (string)UUID + "/about");

I tried using something like the code below but the errors said that the HTTPRequests were "too fast" and failed. I also attempted looping through the data within the dataserver event but I'm still too noob to understand what I am doing wrong. XD

integer x;     // Where x = the number of lines that contain UUIDs in the notecard that was read.
for ( ; x < count; ++x)
	{
       key agent_request = llHTTPRequest( "http://world.secondlife.com/resident/" + llList2String(UUIDs, x),[HTTP_METHOD,"GET"],"");
       
                  -OR-
                  
       key agent_request = llRequestDisplayName(llList2String(UUIDs, x));
    }
                  
http_response(key req,integer stat, list meta, string body)
    {if (req == agent_request) [do the things] isAgent = TRUE;
                  
dataserver(key req, string data)
    { if (req == agent_request) iSAgent = data; return;}    // ???

Is there a more efficient/effective way to determine if a UUID is a Group vs. an Avatar? I know I'm leaving out a lot of code but I can provide more details if needed. Thank you in advance for any help pointing me in the right direction!

Share this post


Link to post
Share on other sites
Posted (edited)

I know of no method to check if a certain UUID belongs to a group or not, but you can use llRequestAgentData() to check to see if a UUID will return an avatar name or a birth date. If DATA_NAME or DATA_BORN returns empty or invalid, then the UUID does not belong to an avatar.
Note that this function is the only one which will return valid data on an existing avatar, even if that avatar is not online!

See http://wiki.secondlife.com/wiki/LlRequestAgentData for more details. The first example script appears to be useful for you, with modifications, of course.

 

UPDATE:
You can use the World API to retrieve info on a user or a group by using llHTTPRequest(), then analyze the headers for meta data.
- http://world.secondlife.com/group/<UUID> will retrieve info on a group
- http://world.secondlife.com/resident/<UUID> will retrieve info on an avatar

If, instead of valid data, your query returns an error, the the group or resident does not exist.

I hope this helps!

 

Edited by Fritigern Gothly
Found new info.
  • Like 1

Share this post


Link to post
Share on other sites
13 minutes ago, Fritigern Gothly said:

I know of no method to check if a certain UUID belongs to a group or not, but you can use llRequestAgentData() to check to see if a UUID will return an avatar name or a birth date. If DATA_NAME or DATA_BORN returns empty or invalid, then the UUID does not belong to an avatar.
Note that this function is the only one which will return valid data on an existing avatar, even if that avatar is not online!

See http://wiki.secondlife.com/wiki/LlRequestAgentData for more details. The first example script appears to be useful for you, with modifications, of course.

Ah ok thank you, Fritigern. I'll give llRequestAgentData() a try. 🙂

Share this post


Link to post
Share on other sites
Posted (edited)

The problem with llRequestAgentData (and I think all the various other request functions using an agent's UUID) is that nothing happens (the dataserver event is not triggered) if the UUID is not that of an agent. You'll have to set a timeout when you call the function (I'd try something like 5 seconds to begin with) and if the dataserver event hasn't triggered in that time, I'd assume the UUID was not that of an agent. This method does, however, leave plenty of scope for errors caused by laggy script environments.

It'd be a lot easier if you could sort your UUIDs into agents and groups beforehand.

Edited by KT Kingsley

Share this post


Link to post
Share on other sites
5 minutes ago, KT Kingsley said:

It'd be a lot easier if you could sort your UUIDs into agents and groups beforehand.

Ooh! I feel silly for not thinking of this beforehand! Thanks!

Share this post


Link to post
Share on other sites
Posted (edited)

Since this is a list you're generating it seems as if it would be easier if you were to just flag what each UUID as an avatar or group. It seems unnecessary to check and ping Second Life's servers if you already know the answer. You could use llParseString2List on each line and check for a flag.

AV|5ffbf977-2cf1-4fd1-b531-102e19147d1b

GRP|ab550636-5aa2-fb43-153f-110cc0c27ae2

llParseString2List just takes a string and converts it into a list by separators. In my example above the "|" is the separator.

so you could check by doing

list data = llParseString2List(notecardLine, ["|"],[])

if(llList2String(data,0) == "GRP") 
{
	llOwnerSay("secondlife:///app/group/" + llList2String(data,1) + "/about");
}
else if(llList2String(data,0) == "AV") 
{
	llOwnerSay("secondlife:///app/agent/" + llList2String(data,1) + "/about");
}
else
{
	llOwnerSay("Some weird error just happened");
}

Hopefully that helps a bit

Please excuse any errors as I'm not online and going off memory!

Edited by Scaler Rexen
  • Like 1

Share this post


Link to post
Share on other sites
Posted (edited)
17 minutes ago, Isolte Ember said:

Ooh! I feel silly for not thinking of this beforehand! Thanks!

Did you not want to test the UUID to see if it belongs to a resident or to a group? Because that would suggest that you would not know which UUID is what, and so sorting would only be possible AFTER the test.

Note that I had updated my answer above, just seconds after you reacted to it, so perhaps using the world API would be your best bet for testing UUIDs.
I did, however, forgot to mention that there is a throttle on HTTP requests, so you have to slow down the speed with which you make the requests. The wiki says "The current limits are 25 requests in 20 seconds for each object, and 1000 in 20 seconds for each owner." so if you make one request per second, you should be fine. Just loop it through a timer.

 

Edited by Fritigern Gothly
Typos galore!
  • Like 1

Share this post


Link to post
Share on other sites

@Fritigern Gothly The notecard with the supplied UUIDs will be editable by the end user and that's where the script is pulling the list of UUID's from. And the user who is entering the UUIDs will already know which is a Group and which is an Avatar, so I could just leave it up to the user to enter Group UUIDs under a separate flag in the notecard than the Avatar UUIDs. XD

  • Like 1

Share this post


Link to post
Share on other sites
12 hours ago, Fritigern Gothly said:

UPDATE:
You can use the World API to retrieve info on a user or a group by using llHTTPRequest(), then analyze the headers for meta data.
- http://world.secondlife.com/group/<UUID> will retrieve info on a group
- http://world.secondlife.com/resident/<UUID> will retrieve info on an avatar

If, instead of valid data, your query returns an error, the the group or resident does not exist.

I hope this helps!

 

Thanks a lot for your help! This is good info to have for future uses. 🙂

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...