Difference between revisions of "LlGiveInventory"

From Second Life Wiki
Jump to navigation Jump to search
m
m (https://jira.secondlife.com/browse/BUG-233614)
 
(5 intermediate revisions by 4 users not shown)
Line 1: Line 1:
{{LSL_Function
{{LSL_Function
|inject-2={{LSL_Function/give|destination|inventory|uuid=false|copyok=*}}{{Issues/SVC-7631}}
|inject-2={{LSL_Function/give|destination|inventory|uuid=false|copyok=*}}{{Issues/SVC-7631}}{{Issues/BUG-5656}}
|func_id=150|func_sleep=0.0|func_energy=10.0
|func_id=150|func_sleep=0.0|func_energy=10.0
|func_sleep_hover=If 'destination' is an avatar the script sleeps for 2.0 seconds. (Giving to objects or attachments has no delay)
|func_sleep_hover=If 'destination' is an avatar the script sleeps for 2.0 seconds. (Giving to objects or attachments has no delay)
Line 12: Line 12:
|spec
|spec
|caveats=
|caveats=
* There is no way to know if the transaction failed.
* 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 {{LSLP|destination}} disabled (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]].
* Scripts reach {{LSLP|destination}} disabled (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 {{LSLP|destination}} is locked then {{LSLP|inventory}} is not transferred and a '''Blocked by permissions''' error is shouted on the [[DEBUG_CHANNEL]].
* If {{LSLP|destination}} is locked then {{LSLP|inventory}} is not transferred and a '''Blocked by permissions''' error is shouted on the [[DEBUG_CHANNEL]].
Line 18: Line 18:
* If {{LSLP|inventory}} is no-copy it is transfered to {{LSLP|destination}} without copying it. Since it is no-copy the only copy is given to {{LSLP|destination}}; removing it from the source prim's inventory.
* If {{LSLP|inventory}} is no-copy it is transfered to {{LSLP|destination}} without copying it. Since it is no-copy the only copy is given to {{LSLP|destination}}; removing it from the source prim's inventory.
** To avoid this problem use [[llGetInventoryPermMask]] to check the permissions of {{LSLP|inventory}}.
** To avoid this problem use [[llGetInventoryPermMask]] to check the permissions of {{LSLP|inventory}}.
* {{HoverLink|Attachment|Attachment - Any object that is currently attached to an avatar|Attachments}} cannot give no-copy inventory. When attempted an error is shouted on [[DEBUG_CHANNEL]].
* {{HoverLink|Attachment|Attachment - Any object that is currently attached to an avatar|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.
* When giving to an attachment that is not owned by the script owner, the receiving attachment must have [[llAllowInventoryDrop]] set to TRUE.
* If {{LSLP|destination}} is 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.
* If {{LSLP|destination}} is 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 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.  
** 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.
* 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." [https://jira.secondlife.com/browse/SVC-7631?focusedCommentId=308665&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-308665 Kelly Linden on SVC-7631]
** "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." [https://jira.secondlife.com/browse/SVC-7631?focusedCommentId=308665&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-308665 Kelly Linden on SVC-7631]
Line 28: Line 29:
|constants
|constants
|examples=
|examples=
<lsl>default
<source lang="lsl2">default
{
{
     touch_start(integer n)
     touch_start(integer n)
Line 35: Line 36:
         llGiveInventory(llDetectedKey(0), llGetScriptName());
         llGiveInventory(llDetectedKey(0), llGetScriptName());
     }
     }
}</lsl>
}</source>
|helpers
|helpers
|also_functions=
|also_functions=

Latest revision as of 08:19, 19 March 2023

Summary

Function: llGiveInventory( key destination, string inventory );

Give inventory to destination.

• key destination avatar or prim UUID
• string inventory an item in the inventory of the prim this script is in

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

  • If destination is an avatar the script sleeps for 2.0 seconds. (Giving to objects or attachments has no delay)
  • If destination is not the owner nor shares the same owner, and inventory does not have transfer permissions, an error is shouted on DEBUG_CHANNEL.
  • When scripts are copied or moved between inventories, their state does not survive the transfer. Memory, event queue and execution position are all discarded.
  • If inventory is missing from the prim's inventory then an error is shouted on DEBUG_CHANNEL.
  • 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 destination disabled (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 destination is locked then inventory is not transferred and a Blocked by permissions error is shouted on the DEBUG_CHANNEL.
  • If destination object is not modifiable then inventory is not transferred and a Blocked by permissions error is shouted on the DEBUG_CHANNEL.
  • If inventory is no-copy it is transfered to destination without copying it. Since it is no-copy the only copy is given to destination; removing it from the source prim's 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 destination is 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

Deep Notes

Tests

•  llGiveInventory Test

Signature

function void llGiveInventory( key destination, string inventory );