Difference between revisions of "WhoAddedWhat"

From Second Life Wiki
Jump to navigation Jump to search
Line 7: Line 7:
if (change & CHANGED_ALLOWED_DROP || CHANGED_INVENTORY)
if (change & CHANGED_ALLOWED_DROP || CHANGED_INVENTORY)
{
{
            integer n = llGetInventoryNumber(INVENTORY_ALL);             
    integer n = llGetInventoryNumber(INVENTORY_ALL);             


            while(n)
    while(n)
            {
    {
                integer valid = llGetListLength(contents);
        integer valid = llGetListLength(contents);
                if(valid != 0)
        if(valid != 0)
                {
        {
                    string added = llGetInventoryName(INVENTORY_ALL, --n);
              string added = llGetInventoryName(INVENTORY_ALL, --n);
                    integer index = llListFindList(contents, [added]);
              integer index = llListFindList(contents, [added]);
                    if(!(~index))
              if(!(~index))
                    {
              {
                        if(type != 10 && (string)type != "") // don't add the object's script to the list of items!
                  if(type != 10 && (string)type != "") // don't add the object's script to the list of items!
                        {
                  {
    content += added; // add the new item to the checklist of inventory items
        content += added; // add the new item to the checklist of inventory items
                        }
                  }
    }
              }
                }
        }
            }
    }
}</lsl>
}</lsl>
[[llAllowInventoryDrop]]

Revision as of 05:21, 1 August 2008

To enable you to tell what has been added to a script in the event of CHANGED_ALLOWED_DROP you can use the following code:

<lsl>// Scripted by Laronzo Fitzgerald

list content[]; // a list of all items already added to the object

if (change & CHANGED_ALLOWED_DROP || CHANGED_INVENTORY) {

   integer n = llGetInventoryNumber(INVENTORY_ALL);            
   while(n)
   {
        integer valid = llGetListLength(contents);
        if(valid != 0)
        {
             string added = llGetInventoryName(INVENTORY_ALL, --n);
             integer index = llListFindList(contents, [added]);
             if(!(~index))
             {
                  if(type != 10 && (string)type != "") // don't add the object's script to the list of items!
                  {

content += added; // add the new item to the checklist of inventory items

                  }
             }
        }
   }

}</lsl>

llAllowInventoryDrop