LlGiveInventory
Looking for the current API? Open the llGiveInventory reference →
Wiki description
Give
inventory to destination.Function notes
If
If
destination is an object then it must be in the same region.If
destination is an avatar they do not have to be in the same region.Caveats
- There is no way to know if the transaction failed. Unless you send a message when inventory is given to a prim and prim's script checks its inventory and sends a message back using llRegionSay.
- Scripts reach
destinationdisabled (not running, and cannot be made to run unless the destination object is taken to inventory and rezzed again, or the script is recompiled). To send a running script to a prim use llSetRemoteScriptAccessPin and llRemoteLoadScriptPin. - If
destinationis locked theninventoryis not transferred and a Blocked by permissions error is shouted on the DEBUG_CHANNEL. - If
destinationobject is not modifiable theninventoryis not transferred and a Blocked by permissions error is shouted on the DEBUG_CHANNEL. - If
inventoryis no-copy it is transfered todestinationwithout copying it. Since it is no-copy the only copy is given todestination; removing it from the source prim's inventory.- the changed event does not fire in this case
- To avoid this problem use llGetInventoryPermMask to check the permissions of
inventory.
- Attachments cannot give or receive no-copy inventory. When attempted an error is shouted on DEBUG_CHANNEL.
- When giving to an attachment that is not owned by the script owner, the receiving attachment must have llAllowInventoryDrop set to TRUE.
- If
destinationis an avatar that refuses to accept it (by manual decline or muting), is in busy mode, or is offline with instant messages capped, it is not returned to the prim's inventory; it is deleted.- It is not returned to the owner. It does not show up in their lost and found or any other inventory folder.
- It is not put in the target's trash folder.
- A successful send to an offline avatar by means of llGiveInventory() counts as an IM against that avatar’s IM cap.
- As of 31th January 2012, llGiveInventory now has similar throttle to instant messages. A throttle of 5k per hour per owner per region; with a maximum burst of 2.5k. This throttle only affects gives to agents, not to non-agents.
- "With 3k subscribers you will want to send slow enough that it takes ~45 minutes to send 1 item to each subscriber. A general safe way would be to send ~2k as fast as you can, then wait 31 minutes and send another 2k." Kelly Linden on SVC-7631
- Be aware that while you script a system to handle the top of these limits that other busy scripted objects can be adding up to the throttle as well, such as vendors.
Examples
default
{
touch_start(integer n)
{
//Gives this script to whoever touches the object.
llGiveInventory(llDetectedKey(0), llGetScriptName());
}
}See also: functions
See also: events
Tests
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)
<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 shared helper source (conditional wiki logic is not evaluated)
{{Issues|SVC-7631|New rate throttle on [[llGiveInventory]]|type=bug}}Original shared helper source (conditional wiki logic is not evaluated)
{{Issues|BUG-5656|[[llGiveInventory]] fails when no-copy items are given to attachments (even no-copy ones) |type=bug|dnc=*}}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.