Don't click here unless you want to be banned.

LSL Wiki : llGetOwnerKey

HomePage :: PageIndex :: RecentChanges :: RecentlyCommented :: UserSettings :: You are
key llGetOwnerKey(key id)

Returns the owner of object with the key id.

This function does not work if the target object is in a different simulator. It returns the target object's key (i.e., it returns id) instead of the owner's key. If an avatar key is passed to this function, the result is the avatars key.

Instead of using llGetOwnerKey(llGetKey()), the owner of the object containing the script can be retrieved using llGetOwner.

Compare with llGetKey.

// this shows the owner of a scripted object that is outputting public chat
default {
    state_entry() {
        llListen(0, "", NULL_KEY, ""); // listen to all public chat
    listen(integer channel, string name, key id, string message) {
        key ownerid;
        string ownername;
        if ( llGetAgentSize(id) != ZERO_VECTOR ) return; // sneaky trick: objects have no agent size, because they're not agents
        // so we only continue if the chat is from an object
        ownerid = llGetOwnerKey(id); // the the owner of the chatting objects
        ownername = llKey2Name(ownerid); // get their name (if the owner is in the same sim)
        // it'd be much better to get the name via llRequestAgentData instead, but i'm trying to keep this example short
        llSay(0, name + " belongs to " + ownername);

Q: How do I get the owner's name instead?
A: If the owner is in the same sim as the object at the time it's called, (if your script is within an attachment) use llKey2Name. Otherwise, you need to use llRequestAgentData and the dataserver event, which takes longer and is more complicated.
A2: One can also use the huge w-hat name.cache file ( to find the name of someone's key by using the llHTTPRequest function.

This article wasn't helpful for you? Maybe the related article at the LSL Portal is able to bring enlightenment.

Functions | Key | owner
There are 7 comments on this page. [Display comments/form]