Skip to content
lsl.devlsl.devLSL Dev

llGiveInventoryList

function
Function syntax
llGiveInventoryList(
  1. key target,// UUID of the target agent or prim in the same region.
  2. string folder,// Name of the destination folder to be created (ignored if the target is an object).
  3. list items// The names of the items in the prim's inventory to transfer.
);
Delay
3 s
Energy
10

Gives the list of inventory items to target as a new folder named folder. If target is an object, the items are passed directly into its inventory and no folder is created. The target must be an agent or an object in the same region.

Gives inventory items to target, creating a new folder to put them in.

How to use
llGiveInventoryList(NULL_KEY, "", []);

Depending upon the type of target this function works differently.

  • Avatar
  • Must be in or able to see into the same Region as the sending object, or recently have been so. SVC-868
  • Places the inventory items in a newly created folder in the avatars inventory (even if there is a folder by the same name, a new one is created).
  • Prim / Object
  • The prim must be in the same region.
  • Does not create a folder.
Example 1
default
{
touch_start(integer n)
{
key toucher = llDetectedKey(0);
string folder = "Item Folder";
list inventory = ["item", "another item"];
llGiveInventoryList(toucher, folder, inventory);
}
}
Example 2
34 collapsed lines
// when the prim is touched, the script checks all other inventory items whether or not they're copiable
// copiable items are added to a list, if the list is not empty when all items have been checked
// the prim gives them to the touching avatar within a single folder
default
{
touch_start(integer num_detected)
{
string thisScript = llGetScriptName();
list inventoryItems;
integer inventoryNumber = llGetInventoryNumber(INVENTORY_ALL);
integer index;
for ( ; index < inventoryNumber; ++index )
{
string itemName = llGetInventoryName(INVENTORY_ALL, index);
if (itemName != thisScript)
{
if (llGetInventoryPermMask(itemName, MASK_OWNER) & PERM_COPY)
{
inventoryItems += itemName;
}
else
{
llSay(0, "Unable to copy the item named '" + itemName + "'.");
}
}
}
if (inventoryItems == [] )
{
llSay(0, "No copiable items found, sorry.");
}
else
{
llGiveInventoryList(llDetectedKey(0), llGetObjectName(), inventoryItems); // 3.0 seconds delay
}
}
}
Example 3
31 collapsed lines
// script gives items to owner only
// all copiable items are given within a single folder
// all no-copy items are transferred separately (only one time, right? right!)
default
{
touch_start(integer num_detected)
{
key owner = llGetOwner();
if (llDetectedKey(0) != owner)
return;
list inventoryItems;
integer inventoryNumber = llGetInventoryNumber(INVENTORY_ALL);
integer index;
for ( ; index < inventoryNumber; ++index )
{
string itemName = llGetInventoryName(INVENTORY_ALL, index);
if (itemName != llGetScriptName() )
{
if (llGetInventoryPermMask(itemName, MASK_OWNER) & PERM_COPY)
{
inventoryItems += itemName;
}
else
{
llGiveInventory(owner, itemName); // 2.0 seconds delay
}
}
}
if (inventoryItems != [] )
llGiveInventoryList(owner, llGetObjectName(), inventoryItems); // 3.0 seconds delay
}
}

From the issue templates included by the wiki article:

  • SVC-868 (fs): llGiveInventoryList should be able to work gridwide
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.