LlGetObjectDetails - Second Life Wiki

LlGetObjectDetails

From Second Life Wiki

Jump to: navigation, search

Summary

Function: list llGetObjectDetails( key id, list params );

Returns a list of the details for id, specifically those requested in params.

• key id avatar or prim UUID that is in the same region or adjacent regions*
• list params OBJECT_* flags

An empty list if id is not found. OBJECT_UNKNOWN_DETAIL is returned when passed an invalid integer parameter.

Specification

Avatar detection range for SL Server 1.34
id Parameter

id holds the UUID of the avatar or prim this function is going to get the details of.

If id is not found in the region, adjacent regions are searched for avatars which match id. An avatar is only considered to have been found if it is inside the region, or within a 34 meter zone outside the region boundaries (see diagram). A single valid result may be returned after the avatar leaves this zone.

params Parameter

The params list is used to indicate which object attributes of interest. The order they are supplied in determines the order of the corresponding return values in the return list.

  • If params contains unsupported integer values, OBJECT_UNKNOWN_DETAIL is placed in the output list.
  • If params contains non-integer types, those values will be silently ignored.
Flags Description Max Length Return Alternatives Local
OBJECT_NAME 1 Gets the prim's name.
If id is an avatar, the Legacy Name is returned.
63 Characters string llGetObjectName
OBJECT_DESC 2 Gets the prim's description.
If id is an avatar, an empty string is returned.
127 Characters string llGetObjectDesc
OBJECT_POS 3 Gets the prim's position in region coordinates.
If id is an avatar outside the region (see above), this position is relative to the region the script is running in.
(37 Characters) vector llGetPos
OBJECT_ROT 4 Gets the prim's rotation. (48 Characters) rotation llGetRot
OBJECT_VELOCITY 5 Gets the object's velocity. (36 Characters) vector llGetVel
OBJECT_OWNER 6 Gets an object's owner key.
If id is an avatar, that avatar's key is returned (which is the same as id).
If id is group-owned, a NULL_KEY is returned.
(36 Characters) key llGetOwner
OBJECT_GROUP 7 Gets the prim's group key.
If id is an avatar, a NULL_KEY is returned.
(36 Characters) key Group
OBJECT_CREATOR 8 Gets the prim's creator key.
If id is an avatar, a NULL_KEY is returned.
(36 Characters) key Creator llGetCreator
OBJECT_RUNNING_SCRIPT_COUNT 9 Gets the number of running scripts attached to the object or agent. (11 Characters) integer llGetScriptState
OBJECT_TOTAL_SCRIPT_COUNT 10 Gets the number of scripts, both running and stopped, attached to the object or agent. (11 Characters) integer llGetInventoryNumber
OBJECT_SCRIPT_MEMORY 11 Gets the total amount of script memory allocated to the object or agent, in bytes. (11 Characters) integer
OBJECT_SCRIPT_TIME 12 Gets the total amount of average script CPU time used by the object or agent, in seconds. (15 Characters) float Top Scripts
OBJECT_PRIM_EQUIVALENCE 13 Gets the prim equivalence of the object. (11 Characters) integer Calculating land impact
OBJECT_SERVER_COST 14 Gets the server cost of the object. (15 Characters) float Server cost
OBJECT_STREAMING_COST 15 Gets the streaming (download) cost of the object. (15 Characters) float Streaming (download) cost
OBJECT_PHYSICS_COST 16 Gets the physics cost of the object. (15 Characters) float Physics cost
OBJECT_CHARACTER_TIME 17 Gets the average CPU time (in seconds) used by the object for navigation, if the object is a pathfinding character. Returns 0 for non-characters. (15 Characters) float Pathfinding characters
OBJECT_ROOT 18 Gets the id of the root prim of the object requested.
If id is an avatar, return the id of the root prim of the linkset the avatar is sitting on (or the avatar's own id if the avatar is not sitting on an object within the region).
(36 Characters) key llGetLinkKey
OBJECT_ATTACHED_POINT 19 Gets the attachment point to which the object is attached. (11 Characters) integer llGetAttached
OBJECT_PATHFINDING_TYPE 20 Gets the pathfinding setting of the object in the region. It returns an integer matching one of the OPT_* constants. (11 Characters) integer Pathfinding types
OBJECT_PHYSICS 21 Gets the boolean detailing if physics is enabled or disabled on the object.
If id is an avatar or attachment, 0 is returned.
(1 Characters) integer llGetStatus PRIM_PHYSICS
OBJECT_PHANTOM 22 Gets the boolean detailing if phantom is enabled or disabled on the object.
If id is an avatar or attachment, 0 is returned.
(1 Characters) integer llGetStatus PRIM_PHANTOM
OBJECT_TEMP_ON_REZ 23 Gets the boolean detailing if temporary is enabled or disabled on the object. (1 Characters) integer PRIM_TEMP_ON_REZ
Max Lengths in parentheses represent how many characters required when it is typecast to a string.

Caveats

  • OBJECT_ROT will return an accurate facing for Avatars seated or in mouselook, but only a rough direction otherwise.
  • Adjacent regions are not searched for prims which match id.
  • Information for avatars that can no longer be found will still be available for a short period (about 45 seconds) but it is not updated.
  • Items in params that are not integers are silently ignored, OBJECT_UNKNOWN_DETAIL is not returned.
  • This function does not return information about items in inventory.
  • llTargetOmega will only effect the return of OBJECT_ROT if the object is physical. If the object is not physical then the original start rotation is returned, llTargetOmega is a client side effect.
  • OBJECT_SCRIPT_MEMORY reports the maximum memory that all scripts in an object could use, not the actual amount of real memory currently used. In particular, Mono scripts only use the amount of memory currently needed, not the max possible. In practice, this makes the number reported a worst case scenario that will never normally be reached by most objects.
  • OBJECT_RUNNING_SCRIPT_COUNT includes crashed scripts in its count.

Important Issues

~ All Issues ~ Search JIRA for related Bugs
   [Won't Fix] OBJECT_RUNNING_SCRIPT_COUNT includes the crashed scripts in the count of running scripts.

Examples

default
{
    collision_start(integer i)
    {
        list a = llGetObjectDetails(llDetectedKey(0), ([OBJECT_NAME, 
                    OBJECT_DESC, OBJECT_POS, OBJECT_ROT, OBJECT_VELOCITY,
                    OBJECT_OWNER, OBJECT_GROUP, OBJECT_CREATOR]));
        llWhisper(0,"UUID: "         + (string)llDetectedKey(0) +
                  "\nName: \""       + llList2String(a,0) + "\"" +
                  "\nDescription: \"" + llList2String(a,1) + "\"" +
                  "\nPosition: "     + llList2String(a,2) +
                  "\nRotation: "     + llList2String(a,3) +
                  "\nVelocity: "     + llList2String(a,4) +
                  "\nOwner: "        + llList2String(a,5) +
                  "\nGroup: "        + llList2String(a,6) +
                  "\nCreator: "      + llList2String(a,7));
    }
}
// group join inviter
// gets the name of the object's active group from the online group profile
 
key groupNameRequestId;
key groupKey;
string groupName;
 
init()
{
    // WARNING:
    // different prims can have different active groups!!!
 
    // get the key of the root prim's group
    groupKey = llList2Key(llGetObjectDetails(llGetLinkKey(LINK_ROOT), [OBJECT_GROUP]), 0);
 
    // request the name of the root prim's group
    groupNameRequestId = llHTTPRequest("http://world.secondlife.com/group/" + (string)groupKey, [], "");
}
 
default
{
    state_entry()
    {
        init();
    }
 
    touch_start(integer num_detected)
    {
        if (groupKey == NULL_KEY || groupName == "")
            return;
 
        key id = llDetectedKey(0);
        llInstantMessage(id,
            "Click the link to join the group '" + groupName + "'\n"
            + "secondlife:///app/group/" + (string)groupKey + "/about");
    }
 
    http_response(key request_id, integer status, list metadata, string body)
    {
        if (request_id != groupNameRequestId)
            return;
 
        list args = llParseString2List(body, ["title"], []);
        groupName = llList2String(llParseString2List(llList2String(args, 1), [">", "<", "/"], []), 0);
    }
}
// aim & shoot
default
{   state_entry()
    {   llRequestPermissions(llGetOwner(), PERMISSION_TAKE_CONTROLS);
    }
    control(key id, integer pressed, integer change) 
    {   if(change & pressed & CONTROL_ML_LBUTTON)
            llSensor("", "", AGENT|PASSIVE|ACTIVE, 96.0, PI/16.0);
    }
    run_time_permissions(integer perm)
    {   if(perm&PERMISSION_TAKE_CONTROLS)
            llTakeControls(0x7FFFFFFF, TRUE, TRUE); 
    }
    sensor(integer n)
    {   key uuid=llDetectedKey(0);
        list a = llGetObjectDetails(uuid, ([
            OBJECT_NAME, OBJECT_DESC, OBJECT_POS, OBJECT_ROT,
            OBJECT_VELOCITY,OBJECT_OWNER, OBJECT_GROUP, OBJECT_CREATOR]));
        llOwnerSay("UUID: " + (string)uuid +
            "\nName: \"" + llList2String(a,0)+ "\"" +
            "\nDecription: \"" + llList2String(a,1) + "\"" +
            "\nPosition: " + llList2String(a,2) +
            "\nRotation: " + llList2String(a,3) +
            "\nVelocity: " + llList2String(a,4) +
            "\nOwner: " + llList2String(a,5) +
            "\nGroup: " + llList2String(a,6) +
            "\nCreator: " + llList2String(a,7)
        );
    }
}
// Object Script Time
default
{
    touch_start(integer num_detected)
    {
        llOwnerSay(llGetObjectName()+" Script Time: "+llList2String(llGetObjectDetails(llGetKey(), [OBJECT_SCRIPT_TIME]), 0));
    }
}

Useful Snippets

See Link/Get for some link related helper functions. Also see llGetLinkPrimitiveParams if you need to get the position and rotation of a linked prim.

integer isLindenTreeOrGrass(key id){
    //Check if it's an OPT_OTHER and not an attachment, which makes it a Linden tree or grass!
    list out = llGetObjectDetails(id, [OBJECT_PATHFINDING_TYPE, OBJECT_ATTACHED_POINT]);
    return (llList2Integer(out, 0) == OPT_OTHER) && !llList2Integer(out, 1);
}

See Also

Functions

•  llKey2Name
•  llGetPrimitiveParams
•  llSetLinkPrimitiveParams
•  llSetPrimitiveParams
•  llGetParcelDetails

Articles

•  Limits SL limits and constrictions
•  Detected
•  Prim Attribute Overloading

Deep Notes

History

Introduced in SL 1.18.3(2)

All Issues

~ Search JIRA for related Issues
   OBJECT_DISPLAY_NAME and OBJECT_USERNAME to llGetObjectDetails()
   [Won't Fix] OBJECT_RUNNING_SCRIPT_COUNT includes the crashed scripts in the count of running scripts.
This article wasn't helpful for you? Maybe the related article at the LSL Wiki is able to bring enlightenment.