Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // This code fragment will not compile on its own and will need to be placed in a more complete script.
- // These functions will look at items in inventory of the prim and report on their permission status.
- //
- // Published under Creative Commons License by Ryonen Moon 8/24/2019
- // You may use this code in your own work, even for commercial products.
- // The only limitation I place is that you may not sell this code, nor represent it as your own.
- //
- // Return a short string representing the perms mask. "C__" = Copy only, "C_T" = Copy and Transfer, "CMT" Copy, Modify, and Transfer
- string permsMaskString(integer perms)
- {
- string result;
- if ((perms & PERM_COPY) == PERM_COPY)
- result += "C";
- else
- result += "_";
- if ((perms & PERM_MODIFY) == PERM_MODIFY)
- result += "M";
- else
- result += "_";
- if ((perms & PERM_TRANSFER) == PERM_TRANSFER)
- result += "T";
- else
- result += "_";
- return result;
- }
- // Chat a permissions overview of all inventory items
- reportInventoryPerms()
- {
- integer i;
- integer copyOnly;
- integer n = llGetInventoryNumber(INVENTORY_ALL);
- string report;
- list reportParts;
- llOwnerSay("Permissions Report");
- for( i = 0; i < n; i++ ) {
- string name = llGetInventoryName(INVENTORY_ALL, i);
- integer permsBase = llGetInventoryPermMask(name, MASK_BASE);
- integer permsNextOwner = llGetInventoryPermMask(name, MASK_NEXT);
- string permsOut = permsMaskString(permsBase) + " " + permsMaskString(permsNextOwner);
- if ((permsNextOwner & PERM_COPY) && (!(permsNextOwner & PERM_MODIFY)) && (!(permsNextOwner & PERM_TRANSFER)))
- copyOnly += 1;
- else {
- string s = " " + permsOut + " .. " + name + "\n";
- if ((llStringLength(report) + llStringLength(s)) < 1024)
- report += s;
- else {
- reportParts += report;
- report = s;
- }
- }
- }
- reportParts += report;
- if (copyOnly < n) {
- llOwnerSay("Base Next");
- integer j;
- integer len = llGetListLength(reportParts);
- do
- {
- string s = llList2String(reportParts, j);
- llOwnerSay(s);
- }
- while (++j < len);
- }
- llOwnerSay ("\n" + (string)n + " Total Items");
- llOwnerSay ((string)copyOnly + " Copy Only");
- llOwnerSay ((string)(n - copyOnly) + " Item(s) of Concern\n");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement