Difference between revisions of "LlGiveInventoryList"

From Second Life Wiki
Jump to navigation Jump to search
(the script is typically used to unpacking boxes sold by venders. By having it use next owner permissions the owner can check the perms at the same time as testing. NEXT is more useful than OWNER)
(revert, this check is intented to prevent giving items away permanently because the old owner cannot copy them. the modified version does not work with items that are sold as no-copy (after transfer))
Line 20: Line 20:
     {
     {
         list        inventory;
         list        inventory;
        string      name;
         integer    num = llGetInventoryNumber(INVENTORY_ALL);
         integer    num = llGetInventoryNumber(INVENTORY_ALL);
        string      script = llGetScriptName();
         integer    i;
         integer    i = 0;
   
   
         for (; i < num; ++i) {
         for (i = 0; i < num; ++i) {
             string name = llGetInventoryName(INVENTORY_ALL, i);
             name = llGetInventoryName(INVENTORY_ALL, i);
             //Don't give them the selling script.
             //Don't give them the selling script.
             if(name != script)
             if(name != llGetScriptName())
             {
             {
                 if(llGetInventoryPermMask(name, MASK_NEXT) & PERM_COPY)
                 if(llGetInventoryPermMask(name, MASK_OWNER) & PERM_COPY)
                 {
                 {
                     inventory += name;
                     inventory += name;

Revision as of 12:22, 22 December 2008

Summary

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

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.
  • Does not create a folder when avatar is a prim UUID.
    • The prim must be in the same region.
All Issues ~ Search JIRA for related Bugs

Examples

<lsl>// When a user clicks this object, this script will give a folder containing everything in the objects inventory // This can serve as a unpacker script for boxed objects

default {

   touch_start(integer total_number)
   {
       list        inventory;
       string      name;
       integer     num = llGetInventoryNumber(INVENTORY_ALL);
       integer     i;

       for (i = 0; i < num; ++i) {
           name = llGetInventoryName(INVENTORY_ALL, i);
           //Don't give them the selling script.
           if(name != llGetScriptName())
           {
               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

Search JIRA for related Issues

Signature

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