User:Toy Wylie/List Creators And Permissions Script

From Second Life Wiki
< User:Toy Wylie
Revision as of 13:59, 3 October 2011 by Toy Wylie (talk | contribs) (first version)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

<lsl>// set the type of inventory you want to list integer type=INVENTORY_ALL; // INVENTORY_ANIMATION

integer num; integer pos;

string currentItem; string currentPerms;

key request;

next() {

   if(pos==num)
   {
       llOwnerSay("Done!");
       llRemoveInventory(llGetScriptName());
       return;
   }
   currentItem=llGetInventoryName(type,pos);
   currentPerms="";
   integer perms=llGetInventoryPermMask(currentItem,MASK_NEXT);
   if(~perms & PERM_COPY)
       currentPerms+="no copy ";
   if(~perms & PERM_MODIFY)
       currentPerms+="no modify ";
   if(~perms & PERM_TRANSFER)
       currentPerms+="no transfer ";
   currentPerms=llStringTrim(currentPerms,STRING_TRIM);
   if(currentPerms!="")
       currentPerms=" ("+currentPerms+")";
   key k=llGetInventoryCreator(currentItem);
   request=llRequestAgentData(k,DATA_NAME);

}

default {

   on_rez(integer dummy)
   {
       llResetScript();
   }
   state_entry()
   {
       num=llGetInventoryNumber(type);
       pos=0;
       next();
   }
   dataserver(key k,string data)
   {
       if(k!=request)
           return;
       llOwnerSay("Inventory item: "+currentItem+currentPerms+" ("+data+")");
       pos++;
       next();
   }

}

</lsl>