Difference between revisions of "LlGetAgentInfo"

From Second Life Wiki
Jump to navigation Jump to search
m
m (that example was messed up....just wow!)
Line 80: Line 80:
default
default
{
{
     touch_start(integer buf)
     touch_start(integer num_detected)
     {
     {
         buf = llGetAgentInfo(llDetectedKey(0));
         key id = llDetectedKey(0);
         string out;
        integer agentInfo = llGetAgentInfo(id);
         if(buf & AGENT_FLYING)
 
             out += "The agent is flying.\n";
         string output;// = "";
         else
 
             out += "The agent is not flying.\n";
         if(agentInfo & AGENT_FLYING)
       
             output += "The agent is flying.\n";
         if(buf & AGENT_ATTACHMENTS)
         else      
             output += "The agent is not flying.\n";
         if(agentInfo & AGENT_ATTACHMENTS)
         {
         {
             if(buf & AGENT_SCRIPTED)
             if(agentInfo & AGENT_SCRIPTED)
                 out += "The agent has scripted attachments.\n";
                 output += "The agent has scripted attachments.\n";
             else
             else
                 out += "The agent's attachments are unscripted.\n";
                 output += "The agent's attachments are unscripted.\n";
         }
         }
         else
         else
             out += "The agent does not have attachments.\n";
             output += "The agent does not have attachments.\n";
       
         if(buf & AGENT_MOUSELOOK)
         if(agentInfo & AGENT_MOUSELOOK)
             out += "the agent is in mouselook.";
             output += "The agent is in mouselook.\n";
        else
            output += "The agent is in normal camera mode.\n";
 
        if (agentInfo & AGENT_AWAY)
            output += "The agent is away.";
         else
         else
             out += "the agent is in normal camera mode.";
             output += "The agent is not away.";
         llWhisper(0, out);
 
        // PUBLIC_CHANNEL has the integer value 0
         llWhisper(PUBLIC_CHANNEL, output);
     }
     }
}
}

Revision as of 14:43, 6 October 2012

Summary

Function: integer llGetAgentInfo( key id );
0.0 Forced Delay
10.0 Energy

Returns an integer bitfield containing the agent information about id.

• key id avatar UUID that is in the same region

Constant Val Returned if agent...
AGENT_ALWAYS_RUN 0x1000 has running ("Always Run") enabled, or is using tap-tap-hold
AGENT_ATTACHMENTS 0x0002 has attachments
AGENT_AUTOPILOT 0x2000 is in "autopilot" mode
AGENT_AWAY 0x0040 is in "away" mode
AGENT_BUSY 0x0800 is in "busy" mode
AGENT_CROUCHING 0x0400 is crouching
AGENT_FLYING 0x0001 is flying or hovering
AGENT_IN_AIR 0x0100 is in the air (jumping, flying or falling)
AGENT_MOUSELOOK 0x0008 is in mouselook
AGENT_ON_OBJECT 0x0020 is sitting on an object (and linked to it)[1]
AGENT_SCRIPTED 0x0004 has scripted attachments
AGENT_SITTING 0x0010 is sitting
AGENT_TYPING 0x0200 is typing
AGENT_WALKING 0x0080 is walking, running or crouch walking

Caveats

Examples

<lsl> default {

   touch_start(integer num_detected)
   {
       key id = llDetectedKey(0);
       integer agentInfo = llGetAgentInfo(id);
       string output;// = "";
       if(agentInfo & AGENT_FLYING)
           output += "The agent is flying.\n";
       else        
           output += "The agent is not flying.\n";

       if(agentInfo & AGENT_ATTACHMENTS)
       {
           if(agentInfo & AGENT_SCRIPTED)
               output += "The agent has scripted attachments.\n";
           else
               output += "The agent's attachments are unscripted.\n";
       }
       else
           output += "The agent does not have attachments.\n";

       if(agentInfo & AGENT_MOUSELOOK)
           output += "The agent is in mouselook.\n";
       else
           output += "The agent is in normal camera mode.\n";
       if (agentInfo & AGENT_AWAY)
           output += "The agent is away.";
       else
           output += "The agent is not away.";
       // PUBLIC_CHANNEL has the integer value 0
       llWhisper(PUBLIC_CHANNEL, output);
   }

}

</lsl>

Notes

This is not a good way of testing if an avatar is in the region, use llGetAgentSize instead.

See Also

Deep Notes

History

Tests

•  llGetAgentInfo_Test

Footnotes

  1. ^ "Sit down" on the avatar context menu allows ground sits anywhere: atop the terrain, on objects or even in the air, so it is possible to sit "on" an object without linking.

Signature

function integer llGetAgentInfo( key id );