Difference between revisions of "LlGetOwner"

From Second Life Wiki
Jump to navigation Jump to search
Line 5: Line 5:
|func_footnote
|func_footnote
|func_desc
|func_desc
|return_text=that is the current owner of the script
|return_text=that is the current owner of the script.
 
NOTE: Because LsL does not reset a script when it is transferred to a new owner, a script can retain old owner identity and even act upon the old owner unless the script is reset. While this appears up front to be a problem with llGetOwner(), this is not the case. The script must be reset upon owner change, which is most easily accomplished using the CHANGE event, as demonstrated below. Without such a reset event, significant problems can be experienced especially in the use of animations and other functions which act upon the owner of the device.
|spec
|spec
|caveats
|caveats=*When the owner of an object changes, code that depends on this function's return value will not automatically update for the new owner or be automatically re-evaluated.
**This requires the reregistration of [[llListen|listens]] and  [[llRequestPermissions|requesting of permissions]] from the new owner as needed.
**Detection of owner change can be achieved with the [[changed]] event in conjunction with the [[CHANGED_OWNER]] flag (see the first example) or by storing the old value and periodically ([[on_rez]]) checking if it has changed. Both techniques are valid though the latter will not detect the sale of the object if it is sold as original in world and not picked up.
|constants
|constants
|examples=<lsl>default
|examples=<lsl>default
Line 15: Line 15:
     state_entry()
     state_entry()
     {
     {
         llInstantMessage(llGetOwner(),"Only you can hear me. Isn't that eerie.");
         llInstantMessage(llGetOwner(), "Only you can hear me. Isn't that eerie.");
     }
     }


     changed(integer change){if (change & CHANGED_OWNER){llResetScript();}}
     changed(integer change)
 
    {
        if (change & CHANGED_OWNER)
            llResetScript();
    }
}</lsl>
}</lsl>
|helpers
|helpers

Revision as of 04:28, 24 February 2008

Summary

Function: key llGetOwner( );
0.0 Forced Delay
10.0 Energy

Returns a key that is the current owner of the script.

Caveats

  • When the owner of an object changes, code that depends on this function's return value will not automatically update for the new owner or be automatically re-evaluated.
    • This requires the reregistration of listens and requesting of permissions from the new owner as needed.
    • Detection of owner change can be achieved with the changed event in conjunction with the CHANGED_OWNER flag (see the first example) or by storing the old value and periodically (on_rez) checking if it has changed. Both techniques are valid though the latter will not detect the sale of the object if it is sold as original in world and not picked up.

Examples

<lsl>default {

   state_entry()
   {
       llInstantMessage(llGetOwner(), "Only you can hear me. Isn't that eerie.");
   }
   changed(integer change)
   {
       if (change & CHANGED_OWNER)
           llResetScript();
   }
}</lsl>

See Also

Functions

•  llGetCreator
•  llGetOwnerKey
•  llDetectedOwner

Deep Notes

Signature

function key llGetOwner();