Difference between revisions of "LlGiveInventoryList"

From Second Life Wiki
Jump to navigation Jump to search
m
m
Line 3: Line 3:
|func=llGiveInventoryList
|func=llGiveInventoryList
|p1_type=key|p1_name=target|p1_desc
|p1_type=key|p1_name=target|p1_desc
|p2_type=string|p2_name=folder|p2_desc=Folder name to use
|p2_type=string|p2_name=folder|p2_desc=folder name to use
|p3_type=list|p3_name=inventory
|p3_type=list|p3_name=inventory
|func_footnote
|func_footnote
|return_text
|return_text
|func_desc=Gives '''inventory''' items to '''target''', creating a new '''folder''' to put them in (if '''target''' is an avatar).
|func_desc=Gives '''inventory''' items to '''target''', creating a new '''folder''' to put them in.
|spec=
|spec=
===target types===
===target types===
Depending upon the type of '''target''' this function works differently.
Depending upon the type of '''target''' this function works differently.
# Avatar
* Avatar
#* Must be or recently have been within the same Region as sending object. [[#SVC-868|SVC-868]]
** Must be or recently have been within the same Region as sending object. [[#SVC-868|SVC-868]]
# Prim / Object
** Places the inventory items in a newly created folder in users inventory (even if there is a folder by the same name, a new one is created).
#* The prim ''must'' be in the same region.
* Prim / Object
#* Does ''not'' create a folder.
** The prim ''must'' be in the same region.
** Does ''not'' create a folder.
|caveats=
|caveats=
* This will not give {{HoverText|no-copy|next owner no-copy}} items.
* This will not give {{HoverText|no-copy|next owner no-copy}} items.

Revision as of 00:25, 16 April 2009

Summary

Function: llGiveInventoryList( key target, string folder, list inventory );

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

• key target group, avatar or prim UUID that is in the same region
• string folder folder name to use
• list inventory a list of items in the inventory of the prim this script is in

Specification

target types

Depending upon the type of target this function works differently.

  • Avatar
    • Must be or recently have been within the same Region as sending object. SVC-868
    • Places the inventory items in a newly created folder in users 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.

Caveats

  • This function causes the script to sleep for 3.0 seconds.
  • If inventory is missing from the prim's inventory then an error is shouted on DEBUG_CHANNEL.
  • This will not give no-copy items.
All Issues ~ Search JIRA for related Bugs

Examples

<lsl>// When any user clicks this object, this script will give a folder containing everything in the objects inventory // This could be used to give away multiple freebies at once.

default {

   touch_start(integer total_number)
   {
       list        inventory;
       integer     num = llGetInventoryNumber(INVENTORY_ALL);
       string      script = llGetScriptName();
       integer     i = 0;

       for (; i < num; ++i) {
           string name = llGetInventoryName(INVENTORY_ALL, i);
           //Don't give them the selling script.
           if(name != script)
           {
               if(llGetInventoryPermMask(name, MASK_OWNER) & PERM_COPY)
               {
                   inventory += name;
               }
               else
               {
                   llSay(0, "Don't have permissions to give you \""+name+"\".");
               }
           }
       }

       if (llGetListLength(inventory) < 1)
       {
           llSay(0, "No items to offer."); 
       }
       else
       {
           // give folder to agent, use name of object as name of folder we are giving
           llGiveInventoryList(llDetectedKey(0), llGetObjectName(), inventory);
       }
   }
}</lsl>

See Also

Events

•  changed

Functions

•  llGiveInventory

Deep Notes

All Issues

~ Search JIRA for related Issues
   llGiveInventoryList should be able to work gridwide

Signature

function void llGiveInventoryList( key target, string folder, list inventory );