LlGiveInventoryList
Looking for the current API? Open the llGiveInventoryList reference →
Wiki description
Gives inventory items to target, creating a new folder to put them in.
Specification
target types
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.
Examples
default
{
touch_start(integer n)
{
key toucher = llDetectedKey(0);
string folder = "Item Folder";
list inventory = ["item", "another item"];
llGiveInventoryList(toucher, folder, inventory);
}
}// 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
}
}
}// 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
}
}See also: functions
See also: events
Shared wiki helpers
The original page also injects shared parameter notes, caveats or issue information through these helpers. Their conditional MediaWiki logic is not reproduced here; inspect the preserved helper source for additional material.
Original shared helper source (conditional wiki logic is not evaluated)
{{Issues|SVC-868|[[llGiveInventoryList]] should be able to work gridwide|type=fs}}Original shared helper source (conditional wiki logic is not evaluated)
<includeonly>{{LSL Injection Test}}{{#if:
{{#vardefine:target-type|~{{#expr:{{#if:{{{avatar|}}}|1|0}}+{{#if:{{{prim|}}}{{{object|}}}|2|0}}+{{#if:{{{link|}}}|4|0}}}}}}
{{#vardefine:pcaveats|{{#var:caveats}}}}
{{#vardefine:caveats}}
{{LSL Function/{{#switch:{{#var:target-type}}|~1=avatar|~2=prim|~4=link|uuid}}|group=|object={{{object|}}}|sim={{{sim|}}}|{{{1|}}}|}}
{{LSL Function/inventory|{{{2|}}}|type={{{type|}}}|uuid={{{uuid|}}}|full={{{full|}}}|insert={{{insert|}}}|}}
{{#vardefine:caveats|{{#var:pcaveats}}{{#ifeq:{{#var:target-type}}|~4||
* If '''{{LSL Param|{{{1}}}}}''' is {{#switch:{{#var:target-type}}|~1=not the owner|~2=not owned by the same person|not the owner nor shares the same owner}}, {{#ifeq:{{{uuid|}}}|true|'''{{LSL Param|{{{2}}}}}''' is not a [[UUID]]}} and '''{{LSL Param|{{{2}}}}}''' does not have transfer permissions, an error is shouted on {{#var:DEBUG_CHANNEL}}.
{{#if:{{{copyok|}}}||
* If '''{{LSL Param|{{{2}}}}}''' {{#if:{{{full|}}}|is not {{HoverLink|:Category:LSL_Permissions/Asset|copy, mod and transfer|full permissions}}|permissions do not allow copy}}, the transfer fails and an error is shouted on {{#var:DEBUG_CHANNEL}}.{{#switch:{{#var:target-type}}
|~1=|* If '''{{LSL Param|{{{1}}}}}''' {{#ifeq:{{#var:target-type}}|~2||is a prim that}} is not in the same region an error is shouted on {{#var:DEBUG_CHANNEL}}.}}}}}}
{{#switch:{{{type|}}}|script|=* When scripts are copied or moved between inventories, their state does not survive the transfer. Memory, event queue and execution position are all discarded.|#default=}}
{{#var:caveats}}}}
{{#vardefine:pcaveats}}
}}</includeonly><noinclude>
{{Multi-lang}}
{{UpdateLink}}
{{#vardefine:caveats}}{{#vardefine:p_target_desc}}{{#vardefine:p_target_hover}}{{#vardefine:p_item_desc}}{{#vardefine:p_item_hover}}
{| {{Prettytable}} {{#vardefine:caveats}}
|+<code><nowiki>{{</nowiki>{{FULLPAGENAMEE}}<nowiki>|target|item|type=sound|uuid=true}}</nowiki></code>{{{{FULLPAGENAMEE}}|target|item|type=sound|uuid=true}}
|-{{Hl2}}
! #var
! value
|-
{{VarPair|caveats}}
|-
{{VarPair|p_target_desc}}
|-
{{VarPair|p_target_hover}}
|-
{{VarPair|p_item_desc}}
|-
{{VarPair|p_item_hover}}
|}
{{#vardefine:caveats}}{{#vardefine:p_target_desc}}{{#vardefine:p_target_hover}}{{#vardefine:p_item_desc}}{{#vardefine:p_item_hover}}
{| {{Prettytable}} {{#vardefine:caveats}}
|+<code><nowiki>{{</nowiki>{{FULLPAGENAMEE}}<nowiki>|target|item|type=sound|uuid=false}}</nowiki></code>{{{{FULLPAGENAMEE}}|target|item|type=sound|uuid=false}}
|-{{Hl2}}
! #var
! value
|-
{{VarPair|caveats}}
|-
{{VarPair|p_target_desc}}
|-
{{VarPair|p_target_hover}}
|-
{{VarPair|p_item_desc}}
|-
{{VarPair|p_item_hover}}
|}
{{#vardefine:caveats}}{{#vardefine:p_target_desc}}{{#vardefine:p_target_hover}}{{#vardefine:p_item_desc}}{{#vardefine:p_item_hover}}
{| {{Prettytable}} {{#vardefine:caveats}}
|+<code><nowiki>{{</nowiki>{{FULLPAGENAMEE}}<nowiki>|target|item|type=script|uuid=true|link=*}}</nowiki></code>{{{{FULLPAGENAMEE}}|target|item|type=script|uuid=true|link=*}}
|-{{Hl2}}
! #var
! value
|-
{{VarPair|caveats}}
|-
{{VarPair|p_target_desc}}
|-
{{VarPair|p_target_hover}}
|-
{{VarPair|p_item_desc}}
|-
{{VarPair|p_item_hover}}
|}
</noinclude>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.