llGiveInventoryList

From Second Life Wiki
Revision as of 02:08, 1 January 2009 by Gia May (talk | contribs) (no no-copy)
Jump to navigation Jump to search

Summary

Function: llGiveInventoryList( key avatar, string folder, list inventory );
3.0 Forced Delay
10.0 Energy

Gives inventory items to avatar in a folder

• key avatar
• string folder
• list inventory a list of items in the inventory of the prim this script is in

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.
  • Avatar must be, or have recently been, within the same Region as sending object.
  • This will not give no-copy items
    • See, and/or vote for SVC-868 requesting gridwide functionality
  • Does not create a folder when avatar is a prim UUID.
    • The prim must be in the same region.

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

Functions

Deep Notes

Signature

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