DOWNTIME ANNOUNCEMENT - Maintenance will be performed from 1AM-3AM Pacific Time on 2010-03-20 (tonight). Please do not edit any pages during this time.

Looking for Viewer 2 Beta help? Right this way!

WhoAddedWhat

From Second Life Wiki

Second Life Wiki > WhoAddedWhat
Jump to: navigation, search

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:

// 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))
              {
                   integer type = llGetInventoryType(added);
 
                   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
                        // Do anything else you want related to the new item here
                   }
              }
         }
    }
}

llAllowInventoryDrop

Personal tools