Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Agent in Sim Detection...most efficient?

Melvin Rowlands
Registered User
Join date: 1 Sep 2007
Posts: 12
11-26-2007 00:51
I'm asking a lot of questions.. :(

Anyhow, llKey2Name is supposed to be able to tell you whether or not a key is in a sim. However, I've noticed that when a person leaves, it can be up to 5 minutes before it updates and gives you an empty string. What is the most efficient way of detecting whether or not a given key is in a sim? I've tried llGetObjectMass, but that also seems quite slow. Thanks.
Day Oh
Registered User
Join date: 3 Feb 2007
Posts: 1,257
11-26-2007 03:29
Logical (boring?) method :-S

From: someone
integer SameRegion(key avatar)
{
vector av_position = llList2Vector(llGetObjectDetails(avatar, [OBJECT_POS]), 0);
return ((avatar != NULL_KEY) && av_position.x >= 0.0 && av_position.x =< 256.0 && av_position.y >= 0.0 && av_position.y =< 256.0);
// returns TRUE if avatar is physically in the same region
// otherwise returns FALSE
}
Melvin Rowlands
Registered User
Join date: 1 Sep 2007
Posts: 12
11-26-2007 06:29
Will this still work after llGetObjectDetails is fixed?
Solar Alter
Registered User
Join date: 21 Nov 2007
Posts: 30
11-26-2007 06:47
"fixed" is in your opinion >.> Remember I came out with that code after I saw Jay using it...
Anyway, no, it will not break, this is normal functioning.
Day Oh
Registered User
Join date: 3 Feb 2007
Posts: 1,257
11-26-2007 08:13
Aw cripes, I forgot about that D:
What is it now, <0.0, 0.0, 0.0> if someone outside the region is more than 96 meters away from the scripted object?

It wouldn't feel quite right, but maybe you could replace all the >= and <= with > and <

Now I really hope someone else suggest something (:
Melvin Rowlands
Registered User
Join date: 1 Sep 2007
Posts: 12
11-26-2007 15:56
Um, how is fixed in my opinion? o.o It was stated on lslwiki that they were going to remove the bug out of llGetObjectDetail which allowed it to detect positions of agents who left the sim. Anyway, is there another method?
Strife Onizuka
Moonchild
Join date: 3 Mar 2004
Posts: 5,887
11-26-2007 17:04
llGetAgentSize is what I use for in sim av verification.
_____________________
Truth is a river that is always splitting up into arms that reunite. Islanded between the arms, the inhabitants argue for a lifetime as to which is the main river.
- Cyril Connolly

Without the political will to find common ground, the continual friction of tactic and counter tactic, only creates suspicion and hatred and vengeance, and perpetuates the cycle of violence.
- James Nachtwey
Bobbyb30 Zohari
SL Mentor Coach
Join date: 11 Nov 2006
Posts: 466
11-26-2007 17:08
From: Melvin Rowlands
I'm asking a lot of questions.. :(

Anyhow, llKey2Name is supposed to be able to tell you whether or not a key is in a sim. However, I've noticed that when a person leaves, it can be up to 5 minutes before it updates and gives you an empty string. What is the most efficient way of detecting whether or not a given key is in a sim? I've tried llGetObjectMass, but that also seems quite slow. Thanks.


llKey2Name is a horrible way.
Use llGetAgentSize() if false, not an agent=D
or use llGetObjectDetails
_____________________