Skip to content
lsl.devlsl.devLSL Dev

llRemoveInventory

function
Function syntax
llRemoveInventory(
  1. string item// Name of the item in the prim's inventory to remove.
);
Energy
10

Permanently deletes the named inventory item from the prim's inventory.

Remove the named inventory item

How to use
llRemoveInventory("");
  • If the current script is removed it will continue to run for a short period of time after this call.
  • With multiple executions an llSleep(0.1) after llRemoveInventory will allow edit window contents to refresh correctly and avoid errors on phantom contents.
  • llRemoveInventory will not trigger a changed event.
Example 1
// Remove the current script from the object
default
{
state_entry()
{
llRemoveInventory(llGetScriptName());
}
}
Example 2
13 collapsed lines
// user-function to include in your script
// deletes all other contents of any type except the script itself
delete_all_other_contents()
{
string thisScript = llGetScriptName();
string inventoryItemName;
integer index = llGetInventoryNumber(INVENTORY_ALL);
while (index)
{
--index; // (faster than index--;)
inventoryItemName = llGetInventoryName(INVENTORY_ALL, index);
if (inventoryItemName != thisScript)
llRemoveInventory(inventoryItemName);
}
}
8 collapsed lines
default
{
state_entry()
{
delete_all_other_contents();
}
}

From the issue templates included by the wiki article:

  • SVC-304 (bug): CHANGED_INVENTORY not triggered by llRemoveInventory()
Original wiki source

Some wiki templates and tables need their original context. View this article on the Second Life Wiki. Technical wording and examples are retained from the source; historical guidance may differ from current behavior.