Difference between revisions of "LlGetObjectDetails"

From Second Life Wiki
Jump to navigation Jump to search
m (Replaced <source> with <syntaxhighlight>)
 
(74 intermediate revisions by 31 users not shown)
Line 1: Line 1:
{{LSL_Function/object|id|prim or avatar|sim=*}}
{{LSL_Function
{{LSL_Function
|inject-2=
{{LSL_Function/limits}}{{LSL_Function/uuid|id|sim=*|group=}}
{{Issues/SCR-87}}{{Issues/SVC-7592}}
|func_id=332|func_sleep=0.0|func_energy=10.0
|func_id=332|func_sleep=0.0|func_energy=10.0
|func=llGetObjectDetails
|func=llGetObjectDetails
|p1_type=key|p1_name=id
|p1_type=key|p1_name=id|p1_desc=&#32;or adjacent regions[[#id_Parameter|*]]
|p2_type=list|p2_name=params|p2_desc=OBJECT_* flags
|p2_type=list|p2_name=params|p2_desc=OBJECT_* flags
|return_type=list|return_text=of the details specified in '''params''' for the object with key '''id'''.
|return_type=list|return_text=of the details for {{LSLP|id}}, specifically those requested in {{LSLP|params}}.  
|func_footnote={{LSL Const|OBJECT_UNKNOWN_DETAIL|integer|-1|c=}} is returned when passed an invalid integer parameter.<br/>
|func_footnote=An empty list if {{LSLP|id}} is not found.{{PBR}}
If '''id''' is not in the sim an empty list is returned.
{{LSL Const|OBJECT_UNKNOWN_DETAIL|integer|-1|c=}} is returned when passed an invalid integer parameter.
|caveats=*Items in '''params''' that are not integers are silently ignored, {{LSL Const|OBJECT_UNKNOWN_DETAIL|integer|-1|c=}} is not returned.
|spec=<div style="padding: 1px; float: left;">[[Image:LlGetObjectdetails-avatar-range.png|thumb=LlGetObjectdetails-avatar-range-thumb.jpg|none|250px|Avatar detection range for SL Server 1.34]]</div>
<h5 style="margin:0;">{{LSLP|id}} Parameter</h5>
{{LSLP|id}} holds the [[UUID]] of the avatar or prim this function is going to get the details of.
 
If {{LSLP|id}} is not found in the region, adjacent regions are searched for avatars which match {{LSLP|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.
 
<h5 style="margin:0;">{{LSLP|params}} Parameter</h5>
The {{LSLP|params}} list is used to indicate the object attributes of interest. The order they are supplied in determines the order of the corresponding return values in the return list.
{{{!}} cellpadding="0" cellspacing="0"
{{!}}
*If {{LSLP|params}} contains unsupported integer values, {{LSL Const|OBJECT_UNKNOWN_DETAIL|integer|-1|c=}} is placed in the output list.
*If {{LSLP|params}} contains non-[[integer]] types, those values will be silently ignored.
{{!}}}
<div style="clear:both;"></div>
|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 {{LSLP|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 {{LSLP|params}} that are not integers are silently ignored, {{LSL Const|OBJECT_UNKNOWN_DETAIL|integer|-1|c=}} 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 [[STATUS_PHYSICS|physical]]. If the object is not physical then the original start rotation is returned, [[llTargetOmega]] is a {{LSLGC|Effects|client side effect}}.
*{{LSL Const|OBJECT_SCRIPT_MEMORY|integer|11|c=}} 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 report the default 64K or what they chose with [[llSetMemoryLimit]], not the current dynamic allocation that is only accessible from within the script. For [[LSO]] scripts, the 16K is real usage in all cases. In practice, this makes the number reported a worst case scenario.
*{{LSL Const|OBJECT_RUNNING_SCRIPT_COUNT|integer|9|c=}} includes crashed scripts in its count.
*{{LSL Const|OBJECT_REZZER_KEY|integer|32|c=}} will return [[NULL_KEY]] for objects rezzed prior to server version 16.01.16.310114
*Objects copied in-world between server versions 16.01.16.310114 & 16.10.14.320687 return the object's creator key for rezzer key.
*Child prims linked before server version 17.11.11.510664 return the root prim's rezzer key.
*Child prims delinked before server version 17.11.11.510664 return NULL_KEY for rezzer key.
*When targeting an agent with {{LSL Const|OBJECT_REZZER_KEY|integer|32|c=}} while they are sitting on an object, the rezzer key of the object's root prim is returned.
*When targeting an attachment with {{LSL Const|OBJECT_MASS|integer|43|c=}}, the mass of the avatar (or that of the avatar's sat-upon object) is returned.
|examples=
|examples=
<pre>
<syntaxhighlight lang="lsl2">default
{
    collision_start(integer num_detected)
    {
      key  id      = llDetectedKey(0);
      list details = llGetObjectDetails(id, ([OBJECT_NAME, OBJECT_DESC,
                            OBJECT_POS, OBJECT_ROT, OBJECT_VELOCITY,
                            OBJECT_OWNER, OBJECT_GROUP, OBJECT_CREATOR]));
      llShout(PUBLIC_CHANNEL, "UUID: " + (string)id
                    + "\nName: "          + llList2String(details, 0)
                    + "\nDescription: "  + llList2String(details, 1)
                    + "\nPosition: "      + llList2String(details, 2)
                    + "\nRotation: "      + llList2String(details, 3)
                    + "\nVelocity: "      + llList2String(details, 4)
                    + "\nOwner: "          + llList2String(details, 5)
                    + "\nGroup: "          + llList2String(details, 6)
                    + "\nCreator: "        + llList2String(details, 7));
    }
}</syntaxhighlight>
 
<syntaxhighlight lang="lsl2">
// 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
default
{
{
     collision_start(integer i)
     state_entry()
     {
     {
         list a = llGetObjectDetails(llDetectedKey(0), ([OBJECT_NAME,
         init();
                    OBJECT_DESC, OBJECT_POS, OBJECT_ROT, OBJECT_VELOCITY,
    }
                    OBJECT_OWNER, OBJECT_GROUP, OBJECT_CREATOR]));
 
         llSetText("UUID: " + (string)llDetectedKey(0) +
    touch_start(integer num_detected)
                "\nName: \"" + llList2String(a,0)+ "\"" +
    {
                "\nDecription: \"" + llList2String(a,1) + "\"" +
         if (groupKey == NULL_KEY || groupName == "")
                "\nPosition: " + llList2String(a,2) +
            return;
                "\nRotation: " + llList2String(a,3) +
 
                "\nVelocity: " + llList2String(a,4) +
        key id = llDetectedKey(0);
                "\nOwner: " + llList2String(a,5) +
        llInstantMessage(id,
                "\nGroup: " + llList2String(a,6) +
            "Click the link to join the group '" + groupName + "'\n"
                "\nCreator: " + llList2String(a,7),
            + "secondlife:///app/group/" + (string)groupKey + "/about");
                <1.0, 1.0, 1.0>, 1.0);
    }
 
    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);
     }
     }
}
}
 
</syntaxhighlight>
</pre>
<syntaxhighlight lang="lsl2">// 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(CONTROL_ML_LBUTTON, 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)
        );
    }
}</syntaxhighlight>
<syntaxhighlight lang="lsl2">// Object Script Time
default
{
    touch_start(integer num_detected)
    {
        llOwnerSay(llGetObjectName()+" Script Time: "+llList2String(llGetObjectDetails(llGetKey(), [OBJECT_SCRIPT_TIME]), 0));
    }
}
</syntaxhighlight>
|spec
|spec
|constants=
|constants={{LSL Constants/Object Details}}
{{{!}} class="sortable" {{Prettytable}}
|helpers=See {{LSLGC|Link/Get}} for some {{LSLGC|Link|link}} related helper functions. Also see [[llGetLinkPrimitiveParams]] if you need to get the position and rotation of a linked prim.
{{!}}-{{Hl2}}
<syntaxhighlight lang="lsl2">
! {{!}} Constant
integer isLindenTreeOrGrass(key id){
! alt="Value" {{!}}
    //Check if it's an OPT_OTHER and not an attachment, which makes it a Linden tree or grass!
! class="unsortable"{{!}} Description
    list out = llGetObjectDetails(id, [OBJECT_PATHFINDING_TYPE, OBJECT_ATTACHED_POINT]);
! class="unsortable"{{!}} Alternatives
    return (llList2Integer(out, 0) == OPT_OTHER) && !llList2Integer(out, 1);
{{!}}-
}
{{!}}{{LSL Const|OBJECT_NAME|integer|1|c=Gets the object's name.}}
</syntaxhighlight>
{{!}}{{#var:value}}
{{!}}{{#var:comment}}
{{!}}
*[[llKey2Name]]
*[[llDetectedKey]]
{{!}}-
{{!}}{{LSL Const|OBJECT_DESC|integer|2|c=Gets the object's description.}}
{{!}}{{#var:value}}
{{!}}{{#var:comment}}<br/>If '''id''' is an avatar, an empty string is returned.
{{!}}
{{!}}-
{{!}}{{LSL Const|OBJECT_POS|integer|3|c=Gets the object's position.}}
{{!}}{{#var:value}}
{{!}}{{#var:comment}}
{{!}}
*[[llDetectedPos]]
{{!}}-
{{!}}{{LSL Const|OBJECT_ROT|integer|4|c=Gets the object's rotation.}}
{{!}}{{#var:value}}
{{!}}{{#var:comment}}
{{!}}
*[[llDetectedRot]]
{{!}}-
{{!}}{{LSL Const|OBJECT_VELOCITY|integer|5|c=Gets the object's velocity.}}
{{!}}{{#var:value}}
{{!}}{{#var:comment}}
{{!}}
*[[llDetectedVel]]
{{!}}-
{{!}}{{LSL Const|OBJECT_OWNER|integer|6|c=Gets the object's owner key.}}
{{!}}{{#var:value}}
{{!}}Gets an object's owner's key.<br/>If '''id''' is group owned, a {{LSL Const|NULL_KEY|key|"00000000-0000-0000-0000-000000000000"|c=Evaluates to false in conditionals just like invalid keys.}} is returned.
{{!}}
*[[llDetectedOwner]]
*[[llGetOwnerKey]]
{{!}}-
{{!}}{{LSL Const|OBJECT_GROUP|integer|7|c=Gets the prims's group key.}}
{{!}}{{#var:value}}
{{!}}{{#var:comment}}<br/>If '''id''' is an avatar, a {{LSL Const|NULL_KEY|key|"00000000-0000-0000-0000-000000000000"|c=Evaluates to false in conditionals just like invalid keys.}} is returned.
{{!}}{{LSLGC|Group}}
{{!}}-
{{!}}{{LSL Const|OBJECT_CREATOR|integer|8|c=Gets the object's creator key.}}
{{!}}{{#var:value}}
{{!}}{{#var:comment}}<br/>If '''id''' is an avatar, a {{LSL Const|NULL_KEY|key|"00000000-0000-0000-0000-000000000000"|c=Evaluates to false in conditionals just like invalid keys.}} is returned.
{{!}}{{LSLGC|Creator}}
{{!}}}
|helpers
|also_functions={{LSL DefineRow||[[llKey2Name]]}}
|also_functions={{LSL DefineRow||[[llKey2Name]]}}
{{LSL DefineRow||[[llGetPrimitiveParams]]}}
{{LSL DefineRow||[[llSetLinkPrimitiveParams]]}}
{{LSL DefineRow||[[llSetPrimitiveParams]]}}
{{LSL DefineRow||[[llGetParcelDetails]]}}
|also_tests
|also_tests
|also_events
|also_events
Line 95: Line 168:
{{LSL DefineRow||[[Prim Attribute Overloading]]}}
{{LSL DefineRow||[[Prim Attribute Overloading]]}}
|notes
|notes
|history=Introduced in SL 1.18.3(2)
|history=
{{HistoryRow|2007|SL 1.18.3(2)|Introduced}}
{{HistoryRow|28-09-2007|SL [[Release_Notes/Second_Life_Release/1.18#Release_Notes_for_Second_Life_1.18.3.285.29_September_28.2C_2007 | 1.18.3.285.29]]|Released}}
|cat1=Object
|cat1=Object
|cat2=Prim
|cat2=Prim
|cat3=Avatar
|cat3=Avatar
|cat4
|cat4=Owner
|cat5=Creator
|cat6=Group
|cat7=Link
|cat8=Click Action
}}
}}

Latest revision as of 12:09, 17 May 2023

Summary

Function: list llGetObjectDetails( key id, list params );
0.0 Forced Delay
10.0 Energy

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 the 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 Length when typecast to a string Return Alternatives Local
OBJECT_NAME 1 Gets the prim's name.
If id is an avatar, the Legacy Name is returned.
max. 63 characters string name llGetObjectName
OBJECT_DESC 2 Gets the prim's description.
If id is an avatar, an empty string is returned.
max. 127 characters string desc 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.
max. 37 characters vector pos llGetPos
OBJECT_ROT 4 Gets the prim's rotation. max. 48 characters rotation rot llGetRot
OBJECT_VELOCITY 5 Gets the object's velocity. 36 characters vector vel 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 owner llGetOwner
OBJECT_GROUP 7 Gets the prim's group key.
If id is an avatar, a NULL_KEY is returned.[1]
36 characters key group Group
OBJECT_CREATOR 8 Gets the prim's creator key.
If id is an avatar, a NULL_KEY is returned.
36 characters key creator Creator llGetCreator
OBJECT_RUNNING_SCRIPT_COUNT 9 Gets the number of running scripts attached to the object or agent. max. 11 characters integer count llGetScriptState
OBJECT_TOTAL_SCRIPT_COUNT 10 Gets the number of scripts, both running and stopped, attached to the object or agent. max. 11 characters integer count llGetInventoryNumber
OBJECT_SCRIPT_MEMORY 11 Gets the total amount of script memory allocated to the object or agent, in bytes. See page for more info. max. 11 characters integer bytes
OBJECT_SCRIPT_TIME 12 Gets the total amount of average script CPU time used by the object or agent, in seconds. See page for more info. max. 15 characters float seconds Top Scripts
OBJECT_PRIM_EQUIVALENCE 13 Gets the prim equivalence of the object. max. 11 characters integer count Calculating land impact
OBJECT_SERVER_COST 14 Gets the server cost of the object. max. 15 characters float cost Server cost
OBJECT_STREAMING_COST 15 Gets the streaming (download) cost of the object. max. 15 characters float cost Streaming (download) cost
OBJECT_PHYSICS_COST 16 Gets the physics cost of the object. max. 15 characters float cost 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. max. 15 characters float seconds Pathfinding characters
OBJECT_ROOT 18 Gets the id of the root prim of the object requested.
If id is an avatar, returns the id of the root prim of the linkset the avatar is sitting on and linked to (or the avatar's own id if the avatar is not sitting on an object within the region).
36 characters key root llGetLinkKey
OBJECT_ATTACHED_POINT 19 Gets the attachment point to which the object is attached. It returns an integer matching one of the ATTACH_* constants. max. 11 characters integer attach_point 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. max. 11 characters integer type Pathfinding types
OBJECT_PHYSICS 21 Gets the integer boolean detailing if physics is enabled or disabled on the object.
If id is an avatar or attachment, 0 is returned.
1 character integer boolean llGetStatus PRIM_PHYSICS
OBJECT_PHANTOM 22 Gets the integer boolean detailing if phantom is enabled or disabled on the object.
If id is an avatar or attachment, 0 is returned.
1 character integer boolean llGetStatus PRIM_PHANTOM
OBJECT_TEMP_ON_REZ 23 Gets the integer boolean detailing if temporary is enabled or disabled on the object. 1 character integer boolean PRIM_TEMP_ON_REZ
OBJECT_RENDER_WEIGHT 24 Gets the avatar's render weight.
If id is an object, 0 is returned. If id is an avatar whose render weight is unknown to the simulator, -1 is returned. The maximum render weight reported by the server is 500000[1].
max. 6 characters integer weight Avatar_Rendering_Cost
OBJECT_HOVER_HEIGHT 25 Gets the hover height of the avatar.
If id is not an avatar, 0.0 is returned. Normal values are in the range [-2.0, 2.0] with a default of 0.0. This value does not reflect the avatar shape's "Hover" slider, only the dynamic viewer setting.
max. 9 characters float height
OBJECT_BODY_SHAPE_TYPE 26 Gets a float which describes the sex setting of the avatar's currently worn shape.
If id is not an avatar, -1.0 is returned.
Normal operational values are in the range [0.0, 1.0].
  • 0.0 is standard female setting,
  • 1.0 is standard male setting.

Intermediate values with visible differences are possible with manually crafted shapes.

max. 9 characters float shape
OBJECT_LAST_OWNER_ID 27 Gets the UUID of the object's previous owner, if known.
  • For group-owned objects, this is the avatar that deeded the object.
  • Returns NULL_KEY for avatars, or objects that were never transferred.
  • A rezzed object taken back to inventory, then re-rezzed, will return its current owner key.
36 characters key last_owner
OBJECT_CLICK_ACTION 28 Gets the click action of the prim. It returns an integer matching one of the CLICK_ACTION_* constants. max. 3 characters integer action
OBJECT_OMEGA 29 Gets the object's rotational velocity (radians per second). 36 characters vector omega llGetOmega
OBJECT_PRIM_COUNT 30 Gets the object's prim count max. 3 characters integer count llGetObjectPrimCount llGetNumberOfPrims
OBJECT_TOTAL_INVENTORY_COUNT 31 Gets the object's total number of inventory items. max. 10 characters integer count llGetInventoryNumber(INVENTORY_ALL)
OBJECT_REZZER_KEY 32 Gets the key of the object that rezzed this object be it an object or an avatar. 36 characters key rezzer
OBJECT_GROUP_TAG 33 Gets the avatar's group tag text.
If id is not an avatar, an empty string is returned.
max. 20 bytes string text
OBJECT_TEMP_ATTACHED 34 Gets the integer boolean detailing if the object is temporarily attached. 1 character integer boolean
OBJECT_ATTACHED_SLOTS_AVAILABLE 35 Gets the avatar's available attachment slot count.
If id is not an avatar, 0 is returned.
max. 2 characters integer count
OBJECT_CREATION_TIME 36 Gets the object's creation time. This time is established with raw material rezzing through the build menu and with mesh uploads.
This time is NOT established with inventory rezzes, scripted rezzes, object modifying, copying or transferring.
If id is an avatar, an empty string is returned.
max. 27 bytes string timestamp
OBJECT_SELECT_COUNT 37 Gets the total number of agents selecting any links in the object.
If id is an avatar, 0 is returned.
max. 3 characters integer count
OBJECT_SIT_COUNT 38 Gets the total number of agents sitting on any links in the object.
If id is an avatar, 0 is returned.
max. 3 characters integer count
OBJECT_ANIMATED_COUNT 39 Gets the integer boolean detailing if the object's root is set to "Animated Mesh" or gets the total number of "Animated Mesh" attachments worn by an agent. max. 1 character integer count
OBJECT_ANIMATED_SLOTS_AVAILABLE 40 Gets the avatar's available "Animated Mesh" attachment slot count.
If id is not an avatar, 0 is returned.
max. 2 characters integer count
OBJECT_ACCOUNT_LEVEL 41 Gets the account level of an avatar.
If id is not an avatar, -1 is returned.
  • 0 is Basic account level.
  • 1 is Premium account level.
  • 5 is Plus account level.
  • 10 is Premium Plus account level.
max. 1 character integer level
OBJECT_MATERIAL 42 Retrieves the physics material set on this object. It returns an integer matching one of the PRIM_MATERIAL_* constants. integer material llGetPrimitiveParams
PRIM_MATERIAL
OBJECT_MASS 43 Gets the mass (in Kilograms) of this object's linkset. float mass llGetMassMKS
OBJECT_TEXT 44 Gets the floating text displayed above this object. string text llGetPrimitiveParams
PRIM_TEXT
OBJECT_REZ_TIME 45 Retrieves the time that this object was rezzed. string time
OBJECT_LINK_NUMBER 46 Get this object's index in the linkset. integer link_number llGetLinkNumber
OBJECT_SCALE 47 Get the size of this object. vector scale llGetScale
OBJECT_TEXT_COLOR 48 Gets the color of the floating text displayed above this object. vector color llGetPrimitiveParams
PRIM_TEXT
OBJECT_TEXT_ALPHA 49 Gets the alpha value of the floating text displayed above this object. float alpha llGetPrimitiveParams
PRIM_TEXT
OBJECT_HEALTH 50 Retrieves the health of an avatar or prim. float health llGetPrimitiveParams
PRIM_HEALTH

llGetHealth

OBJECT_DAMAGE 51 Retrieves the amount of damage a prim inflicts on collision. float damage llGetPrimitiveParams
PRIM_DAMAGE
OBJECT_DAMAGE_TYPE 52 Retrieves the type of damage a prim inflicts on collision. It returns an integer that can match one of the DAMAGE_TYPE_* constants, be a custom damage type or be repurposed by a combat system. integer damage_type llGetPrimitiveParams
PRIM_DAMAGE

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 report the default 64K or what they chose with llSetMemoryLimit, not the current dynamic allocation that is only accessible from within the script. For LSO scripts, the 16K is real usage in all cases. In practice, this makes the number reported a worst case scenario.
  • OBJECT_RUNNING_SCRIPT_COUNT includes crashed scripts in its count.
  • OBJECT_REZZER_KEY will return NULL_KEY for objects rezzed prior to server version 16.01.16.310114
  • Objects copied in-world between server versions 16.01.16.310114 & 16.10.14.320687 return the object's creator key for rezzer key.
  • Child prims linked before server version 17.11.11.510664 return the root prim's rezzer key.
  • Child prims delinked before server version 17.11.11.510664 return NULL_KEY for rezzer key.
  • When targeting an agent with OBJECT_REZZER_KEY while they are sitting on an object, the rezzer key of the object's root prim is returned.
  • When targeting an attachment with OBJECT_MASS, the mass of the avatar (or that of the avatar's sat-upon object) is returned.

Examples

default
{
    collision_start(integer num_detected)
    {
      key  id      = llDetectedKey(0);
      list details = llGetObjectDetails(id, ([OBJECT_NAME, OBJECT_DESC,
                            OBJECT_POS, OBJECT_ROT, OBJECT_VELOCITY,
                            OBJECT_OWNER, OBJECT_GROUP, OBJECT_CREATOR]));
      llShout(PUBLIC_CHANNEL, "UUID: " + (string)id
                    + "\nName: "          + llList2String(details, 0)
                    + "\nDescription: "  + llList2String(details, 1)
                    + "\nPosition: "      + llList2String(details, 2)
                    + "\nRotation: "       + llList2String(details, 3)
                    + "\nVelocity: "       + llList2String(details, 4)
                    + "\nOwner: "          + llList2String(details, 5)
                    + "\nGroup: "          + llList2String(details, 6)
                    + "\nCreator: "        + llList2String(details, 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(CONTROL_ML_LBUTTON, 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

• 2007 SL 1.18.3(2) Introduced
• 28-09-2007 SL 1.18.3.285.29 Released

Footnotes

  1. ^ There are at least 3 JIRA's about OBJECT_GROUP and avatars, LL has refused all of them. Most recently on December 5th 2013 in BUG-4654.
  2. ^ The ranges in this article are written in Interval Notation.
  1. On July 2016, Rolig Loon commented on the talk page for llGetObjectDetails() that allegedly SL viewers are showing render weights of 1,300,000.

Signature

function list llGetObjectDetails( key id, list params );