llDie
Jump to navigation
Jump to search
LSL Portal | Functions | Events | Types | Operators | Constants | Flow Control | Script Library | Categorized Library | Tutorials |
Summary
Function: llDie( );0.0 | Forced Delay |
0.0 | Energy |
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
- The script may not stop executing immediately after this function is called (SVC-7421).
- 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.
- To detach an object from the avatar call llDetachFromAvatar.
- Detaching a temporary attachment will cause the attachment to be deleted.
Examples
default
{
state_entry()
{
// red and opaque text
llSetText("<!-- touch to kill --!>", <1.0, 0.0, 0.0>, 1.0);
}
touch_start(integer num_detected)
{
llSay(0, "Good bye, cruel world!");
llDie();
}
}
//Counts down from 5 to 1, then dies
default
{
state_entry()
{
integer index = 5;
while (index)
{
// wait a sec
llSleep(1.0);
llSay(0, (string)index);
--index;
}
llDie();
}
}
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:
// http://wiki.secondlife.com/wiki/llDie
default
{
state_entry()
{
llOwnerSay("llGetRegionTimeDilation()");
llOwnerSay((string) llGetRegionTimeDilation());
llRemoveInventory(llGetScriptName());
}
}