Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

1.6 Change to llGetAgentInfo

Kelly Linden
Linden Developer
Join date: 29 Mar 2004
Posts: 896
03-03-2005 15:47
One of the features of 1.6 is the addition of many more return types to llGetAgentInfo.

llGetAgentInfo has always returned a bitfield that returned TRUE or FALSE for a combination of agent information: AGENT_FLYING, AGENT_ATTACHMENTS and AGENT_SCRIPTED

Because there were so few it was possible to script in such a way where the entire returned integer was saved and compared against the next call for differences. These would mostly work, especially in the case of flying because AGENT_ATTACHMENTS and AGENT_SCRIPTED do not change very often.

However, in 1.6 there will be 6 new returns:
AGENT_MOUSELOOK
AGENT_SITTING
AGENT_ON_OBJECT
AGENT_AWAY
AGENT_WALKING
AGENT_IN_AIR

These returns change much more often and can potentially make scripts written to detect flying suddenly think their status has changed much, much more frequently.

An example of code that may not work as expected after 1.6:
CODE
integer lastinfo;

default
{
state_entry()
{
llSetTimerEvent(1);
}

timer()
{
integer info = llGetAgentInfo(llGetOwner());
if (lastinfo != info)
{
// ...
}
lastinfo = info;
}
}
Here is the same code 'fixed' for 1.6. The difference is the line info = AGENT_FLYING & info; which strips out all data except the AGENT_FLYING bit.
CODE
integer lastinfo;

default
{
state_entry()
{
llSetTimerEvent(1);
}

timer()
{
integer info = llGetAgentInfo(llGetOwner());
// New line to only save the status needed instead of everything
info = AGENT_FLYING & info;
if (lastinfo != info)
{
// ...
}
lastinfo = info;
}
}



_____________________
- Kelly Linden
Strife Onizuka
Moonchild
Join date: 3 Mar 2004
Posts: 5,887
03-03-2005 17:27
Let me see if i understand what these do.

AGENT_MOUSELOOK - av in mouse look
AGENT_SITTING - av is sitting on an object or the ground
AGENT_ON_OBJECT - av is standing or sitting on an object
AGENT_AWAY - av is away
AGENT_WALKING - av is actively walking
AGENT_IN_AIR - av is floating in the air and/or flying.
_____________________
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
Kelly Linden
Linden Developer
Join date: 29 Mar 2004
Posts: 896
03-03-2005 17:49
Mostly correct with one exception:
AGENT_ON_OBJECT - av is sitting on an object

I suppose it should be AGENT_SITTING_ON_OBJECT but I opted for the less verbose with an appropriate tool tip and documentation.

Either in 1.6.0 or 1.6.1 there will also be the following:
AGENT_TYPING - the avatar is typing
AGENT_CROUCHING - the avatar is crouching
_____________________
- Kelly Linden
Zuzi Martinez
goth dachshund
Join date: 4 Sep 2004
Posts: 1,860
03-03-2005 19:03
sweet. can we please also have AGENT_GRIEFING? i think it would be useful to detect that. :D
_____________________
Zuzi Martinez: if Jeska was Canadian would she be from Jeskatchewan? that question keeps me up at nite.
Jeska Linden: That is by far the weirdest question I've ever seen.
Hinkley Baldwin
Registered User
Join date: 13 May 2004
Posts: 77
03-04-2005 02:35
Just to clarify, if an agent is sat on an object are both AGENT_SITTING and AGENT_ON_OBJECT set?
Francis Chung
This sentence no verb.
Join date: 22 Sep 2003
Posts: 918
03-04-2005 04:57
From: Kelly Linden

Either in 1.6.0 or 1.6.1 there will also be the following:
AGENT_TYPING - the avatar is typing
AGENT_CROUCHING - the avatar is crouching


While we're here, would it be possible to add an AGENT_RUNNING? Currently, there's no way to differentiate between an avatar in run mode, and walk mode.

(What about llGetAnimation you say? Well if the avatar is walking down an incline, they will be "running", but not in run mode)

Conversely, AGENT_TYPING and AGENT_CROUCHING can be determined by using llGetAnimationList and llGetAnimation respectively.
_____________________
--
~If you lived here, you would be home by now~
Kyrah Abattoir
cruelty delight
Join date: 4 Jun 2004
Posts: 2,786
03-04-2005 05:17
what about an event that fire when the agent info change?
_____________________

tired of XStreetSL? try those!
apez http://tinyurl.com/yfm9d5b
metalife http://tinyurl.com/yzm3yvw
metaverse exchange http://tinyurl.com/yzh7j4a
slapt http://tinyurl.com/yfqah9u
Fuzzy Duck
Out Of Focus
Join date: 19 Feb 2005
Posts: 48
03-04-2005 08:48
From: Kelly Linden

However, in 1.6 there will be 6 new returns:
AGENT_MOUSELOOK
AGENT_SITTING
AGENT_ON_OBJECT
AGENT_AWAY
AGENT_WALKING
AGENT_IN_AIR


What about AGENT_BUSY??
_____________________
Kelly Linden
Linden Developer
Join date: 29 Mar 2004
Posts: 896
03-04-2005 08:59
From: Hinkley Baldwin
Just to clarify, if an agent is sat on an object are both AGENT_SITTING and AGENT_ON_OBJECT set?

Correct.


From: Francis Chung
While we're here, would it be possible to add an AGENT_RUNNING? Currently, there's no way to differentiate between an avatar in run mode, and walk mode.

(What about llGetAnimation you say? Well if the avatar is walking down an incline, they will be "running", but not in run mode)

Conversely, AGENT_TYPING and AGENT_CROUCHING can be determined by using llGetAnimationList and llGetAnimation respectively.

I will look into this. Most likely won't happen for 1.6.

From: Kyrah Abattoir
what about an event that fire when the agent info change?

Unfortunately these changes can happen very frequently, multiplied by potentially tracking many avatars in a sim via this method, multiplied again by potentially having many scripts tracking each avatar. LSL script callbacks aren't really cheap and adding such a function is very likely to add a not insignificant amount of load to the system. I will take a closer look but I doubt it is really feasable currently.
_____________________
- Kelly Linden
Jillian Callahan
Rotary-winged Neko Girl
Join date: 24 Jun 2004
Posts: 3,766
03-04-2005 09:07
From: Kelly Linden
Unfortunately these changes can happen very frequently, multiplied by potentially tracking many avatars in a sim via this method, multiplied again by potentially having many scripts tracking each avatar. LSL script callbacks aren't really cheap and adding such a function is very likely to add a not insignificant amount of load to the system. I will take a closer look but I doubt it is really feasable currently.

What if one had to set up the triggers, much like one does with timer()?

llSetAgentEvent(key id, integer events); // and one could set this up for several agents, or stop triggering it for an agent by passing a 0 for events.

agent_event(key id, integer events)

Where events are the bits like AGENT_FLYING...

Might that reduce to load to managable levels?
_____________________
Kelly Linden
Linden Developer
Join date: 29 Mar 2004
Posts: 896
03-04-2005 09:15
I will look into it, as I said before. I think though that 'worst case' planning is still the same, lots of scripts, lots of AVs, lots of changes means lots of script call backs.
_____________________
- Kelly Linden
Kelly Linden
Linden Developer
Join date: 29 Mar 2004
Posts: 896
03-04-2005 09:19
From: Fuzzy Duck
What about AGENT_BUSY??

Good idea. I don't know if it will make it to 1.6 or have to wait for 1.6.1.
_____________________
- Kelly Linden
Tinker LaFollette
Dilettante
Join date: 6 Jan 2004
Posts: 86
03-04-2005 15:15
Well, as long as we're piling on ideas, how about AGENT_GENDER? (0 for female, 1 for male, if that's not too Freudian...)
Catherine Omega
Geometry Ninja
Join date: 10 Jan 2003
Posts: 2,053
03-04-2005 20:10
From: Tinker LaFollette
Well, as long as we're piling on ideas, how about AGENT_GENDER? (0 for female, 1 for male, if that's not too Freudian...)


I'm not totally clear on how this works, but I'm pretty sure that there isn't currently any mechanism for the server to look up the avatar settings. I'm not sure what the best way to do it would be -- is that data already on the simulator server, or would it require additional communiation between the sim and the asset server?

Regardless of the specifics, I'm reasonably confident that this would be far harder to add than simply checking if the agent is flying or away. That's readily available to the sim, since it's... already got it. :)
_____________________
Need scripting help? Visit the LSL Wiki!
Omega Point - Catherine Omega's Blog
Fuzzy Duck
Out Of Focus
Join date: 19 Feb 2005
Posts: 48
03-05-2005 01:40
From: Kelly Linden
Good idea. I don't know if it will make it to 1.6 or have to wait for 1.6.1


yay :D
_____________________
Torley Linden
Enlightenment!
Join date: 15 Sep 2004
Posts: 16,530
03-05-2005 01:42
^ I am in awe of Fuzzy's cute vigilance in pursuing this addition and I also hope it will be added soon. Thanks Lindens. :)
_____________________
Lex Neva
wears dorky glasses
Join date: 27 Nov 2004
Posts: 1,361
03-05-2005 08:33
From: Tinker LaFollette
Well, as long as we're piling on ideas, how about AGENT_GENDER? (0 for female, 1 for male, if that's not too Freudian...)


Not only would this be infeasible for the reasons Catherine said, but also, I've known people who have created a male av using the female shape and vice versa. There's no way for the sim to figure that one out.