Difference between revisions of "LlGetOwnerKey"

From Second Life Wiki
Jump to navigation Jump to search
m
 
(15 intermediate revisions by 7 users not shown)
Line 1: Line 1:
{{LSL_Function/uuid|id|sim=*}}{{LSL_Function
{{LSL_Function
|inject-2={{LSL_Function/prim|id|sim=*}}
|func_id=182|func_sleep=0.0|func_energy=10.0
|func_id=182|func_sleep=0.0|func_energy=10.0
|func=llGetOwnerKey|sort=GetOwnerKey
|func=llGetOwnerKey|sort=GetOwnerKey
Line 5: Line 6:
|func_footnote
|func_footnote
|func_desc
|func_desc
|return_text=that is the owner of object '''id'''
|return_text=that is the owner of prim {{LSLP|id}}
|spec
|spec
|caveats=
|caveats=
* Returns '''id''' if '''id''' is not found in the region or is not an object.
* Returns {{LSLP|id}} if {{LSLP|id}} is not found in the region or is not a prim.
* '''id''' can be any prim in the object.
** Owner information becomes unavailable ''immediately'' on derez or detach. For example, if a prim chats at derez or detach time, {{LSLP|id}} can be returned even inside [[listen]] events of nearby objects. <sup>{{Jira|SVC-5095}}</sup>
* Also returns {{LSLP|id}} for avatars, use [[llGetAgentSize]] instead to distinguish them from prims that do not exist.
* Returns NULL_KEY if the id passed in is not a valid key
|constants
|constants
|examples=<lsl>key owner;
|examples=
 
<source lang="lsl2">
default
default
{
{
     state_entry()
     state_entry()
     {
     {
        owner = llGetOwner();
    //  listen to anything talking on channel 1
         llListen(1, "", "", "");
         llListen(1, "", NULL_KEY, "");
    //  Type "/1 " + message (such as "/1 poke") to chat 'message' on channel 1.
     }
     }
     on_rez(integer a)
 
     listen(integer channel, string name, key id, string message)
     {
     {
         owner = llGetOwner();
         key ownerOfThisObject = llGetOwner();
    }
        key ownerOfSpeaker = llGetOwnerKey(id);
    listen(integer chan, string name, key id, string msg)
 
    {
    // if whoever is talking is the owner of this object
        if(llGetOwnerKey(id) == owner)
    //  or if the owner of the object talking is the owner of this object
        {//Only triggers if what spoke is the owner or if they share the same owner
        if (ownerOfSpeaker == ownerOfThisObject)
             llOwnerSay(name + " has the same owner as me ^_^");
        {
             llOwnerSay("'" + name + "' has the same owner as me ^_^");
         }
         }
     }
     }
}</lsl>
}
</source>
|helpers
|helpers
|also_functions={{LSL DefineRow||[[llKey2Name]]|}}
|also_functions={{LSL DefineRow||[[llKey2Name]]|}}
{{LSL DefineRow||[[llRequestAgentData]]|}}
{{LSL DefineRow||[[llRequestAgentData]]|}}
{{LSL DefineRow||[[llGetObjectDetails]]|}}
{{LSL DefineRow||[[llGetObjectDetails]]|[[OBJECT_OWNER]]}}
{{LSL DefineRow||[[llGetOwner]]|}}
{{LSL DefineRow||[[llGetOwner]]|}}
|also_tests
|also_tests
|also_events
|also_events
|also_articles
|also_articles
|notes=When used on an avatars key, the key of that avatar is returned again. So avatars are owned by themself.
|notes
|cat1=Owner
|cat1=Owner
|cat2=Key
|cat2=Key

Latest revision as of 11:15, 25 September 2017

Summary

Function: key llGetOwnerKey( key id );

Returns a key that is the owner of prim id

• key id prim UUID that is in the same region

Caveats

  • Returns id if id is not found in the region or is not a prim.
    • Owner information becomes unavailable immediately on derez or detach. For example, if a prim chats at derez or detach time, id can be returned even inside listen events of nearby objects. SVC-5095
  • Also returns id for avatars, use llGetAgentSize instead to distinguish them from prims that do not exist.
  • Returns NULL_KEY if the id passed in is not a valid key
All Issues ~ Search JIRA for related Bugs

Examples

default
{
    state_entry()
    {
    //  listen to anything talking on channel 1
        llListen(1, "", NULL_KEY, "");
    //  Type "/1 " + message (such as "/1 poke") to chat 'message' on channel 1.
    }

    listen(integer channel, string name, key id, string message)
    {
        key ownerOfThisObject = llGetOwner();
        key ownerOfSpeaker = llGetOwnerKey(id);

    //  if whoever is talking is the owner of this object
    //  or if the owner of the object talking is the owner of this object
        if (ownerOfSpeaker == ownerOfThisObject)
        {
            llOwnerSay("'" + name + "' has the same owner as me ^_^");
        }
    }
}

See Also

Deep Notes

Search JIRA for related Issues

Signature

function key llGetOwnerKey( key id );