Jump to content

Strange llGetAgentList() behaviour


Phil Deakins
 Share

You are about to reply to a thread that has been inactive for 3608 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

I'm writing an avatar detection system, using llGetAgentList() with the AGENT_LIST_PARCEL parameter. To get each avatar's distance from the system object, I'm using llGetObjectDetails(agent, OBJECT_POS) and llGetPos(). The difference between the two is the distance the avatar is from the object.

When I first set it up there was only me in range and, moving around changed the calculated distance of me from the object. That was fine.

The I brought an alt into the room (a few meters from the object). I could still move around and distance changed accordingly, but, although it found the alt, is always had her distance at 3504.033 meters - that's where she TPed from. Moving her around didn't cause that distance to change one iota. It wasn't working properly.

I just had a computer problem which caused me to reboot, and I logged the alt in first - straight into the room where the object is. I logged myself in after the alt, also straight into the room where the object is. This time it's a bit weirder.

Now, the alt can move around and the distance reflects it. But it has me at 3504.033 meters from it - that's where the alt TPed from before the reboot. I can move around near the object but it makes no difference.

In both cases, the first one in the room is tracked correctly, but the second one isn't tracked at all, and has the permanent 3304m distance, even though the object does pick the 2nd one up by key.

I've no idea what's causing the problem. Does anyone have any ideas at all?

 

Correction: The 3504m isn't where the alt TPed from. She was at 3236m before she TPed. So I've no idea where the 3504m number comes from. My avatr hasn't been away from the room the object is in and yet it's still permanently seen as being 3504m distant.

Link to comment
Share on other sites

Without being able to see your code it's a bit of a guessing game, but it looks to me as if you're not counting the number of list entries properly.    I'm wondering if 3504 isn't the distance from the object to <0,0,0> on the sim, and that the script, not able to read the last list entry, is returning ZERO_VECTOR for the last av's position.

 

 

Link to comment
Share on other sites

It's hard to tell without seeing exactly how you are handling things in your script.  If you expect to get current distances to each avatar, be sure that you are calculating them all in the same loop each time.

integer length = llGetListLength( gAllAvs);  // The list of UUIDs created by llGetAgentList, which need to be refreshed periodicallyinteger i;while (i < length){    list temp = llGetObjectDetails(llList2Key(gAllAvs,i),[OBJECT_NAME,OBJECT_POS]);    string Who = llList2String(temp,0);    vector Where = llList2Vector(temp,1);    float HowFar = llVecDist(Where, llGetPos());    llOwnerSay(Who + "   :   " + (string)HowFar);    ++i;}

 

 

 

Link to comment
Share on other sites

Hi Innula. Panic over.

It's embarrasing but I'd made a mistake. I'll try to describe it...

I'm using a for loop to go through the agents returned by llGetAgentList(), with i as the counter (for(i = 0 etc.).

Only one item is returned in the list for each agent, but I'd used the i index of the list for each agent instead of the 0 index. It worked for the first agent but the 2nd naturally went wrong. I think that would be the zero vector you thought might have crept in.

It all fixed now, and thank you for taking an interest :)

 

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 3608 days.

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
 Share

×
×
  • Create New...