Difference between revisions of "LlDie"

From Second Life Wiki
Jump to navigation Jump to search
m (Added some handy Q&A from http://lslwiki.net/lslwiki/wakka.php?wakka=lldie)
(Undo revision 308902 by Randur Source (Talk) copyright)
Line 37: Line 37:
}
}
</lsl>
</lsl>
<b>Q:</b> How do I delete another object?<br/>
<b>A:</b> You can't. Your best option is to place a script inside the object you wish to delete and then use chat to tell it when to do so.<br/>
Alternatively, llGiveInventory can be used to give a copy of a script to another object, but the script will always be turned off within the recipient object. Scripts can only be turned on by manually activating them.<br/>
[[llRemoteLoadScriptPin]] may be useful, but if you can already get into the object that way, you can likely put a script containing [[llDie]] in it already.<br/>
<br/>
<b>Q:</b> How do I make my object delete itself if it goes off my land?<br/>
<b>A:</b> Use a [[timer]] and [[llGetLandOwnerAt]]([[llGetPos]]()).<br/>
<br/>
<b>Q:</b> How do I make my object delete or return itself when it leaves the sim?<br/>
<b>A:</b> See [[llSetStatus]] and the [[STATUS_DIE_AT_EDGE]] and [[STATUS_RETURN_AT_EDGE]] constants.
|also_functions={{LSL DefineRow||[[llDetachFromAvatar]]|}}
|also_functions={{LSL DefineRow||[[llDetachFromAvatar]]|}}
{{LSL DefineRow||[[llBreakLink]]|}}
{{LSL DefineRow||[[llBreakLink]]|}}

Revision as of 09:48, 8 April 2009

Summary

Function: llDie( );

Deletes the object. The object does not go to the owners Inventory:Trash.

If called in any prim in the link set the result will be the deletion of the entire object.
To remove a single prim from an object use llBreakLink first.

Caveats

  • After this function is called there is no way to undo the deletion of the object.
  • Has no effect if called from within an attachment; there is no way to delete an attachment.
All Issues ~ Search JIRA for related Bugs

Examples

<lsl>//Counts down from 5 to 1, then dies default {

   state_entry()
   {
       integer olf;
       for(olf = 5; olf > 0; --olf)
           llSay(0, (string)olf);
       llDie();
   }
}</lsl>

Useful Snippets

llRemoveInventory of llGetScriptName deletes just the calling script, rather than all of the object that the calling script contains. For instance, you can write a script that chats a little when dragged on to an object from inventory and then politely disappears itself, such as: <lsl> // http://wiki.secondlife.com/wiki/llDie default {

   state_entry()
   {
       llOwnerSay("llGetRegionTimeDilation()");
       llOwnerSay((string) llGetRegionTimeDilation());
       llRemoveInventory(llGetScriptName());
   }

} </lsl>

See Also

Functions

•  llDetachFromAvatar
•  llBreakLink

Articles

•  Attachment

Deep Notes

Search JIRA for related Issues

Signature

function void llDie();