Difference between revisions of "Check Animations Permissions Tool"

From Second Life Wiki
Jump to navigation Jump to search
Line 7: Line 7:
Copy the text below the line into a script, and follow the directions below.
Copy the text below the line into a script, and follow the directions below.


_______________________________________________________________
----
 


  //Purpose: a tool to check that animations have correct the permissions for the next owner
  //Purpose: a tool to check that animations have correct the permissions for the next owner
  //The logic is based on the assumption that full perms you have licenced
  //The logic is based on the assumption that full perms you have licenced
  //should never have both copy and transfer enabled, only one or the other.
  //should never have both copy and transfer enabled, only one or the other.
  //Confirms to you if all is well; let's you know what the problem ones are otherwise.
  //Confirms to you if all is well; lets you know what the problem ones are otherwise.
  //Drop into the prim holding your MLPV2 when you have finished set up.
  //Drop into the prim holding your MLPV2 when you have finished set up.
  //Correct any errors.
  //Correct any errors.
Line 22: Line 21:
  //Chaz Longstaff. June 2008.
  //Chaz Longstaff. June 2008.
  checkPerms() {
  checkPerms() {
    string perms_copy;
    string perms_copy;
    integer i;
    integer i;
    string perms_xfer;
    string perms_xfer;
    string ObjectName;
    string ObjectName;
    list WarningList = [];
    list WarningList = [];
    integer num = llGetInventoryNumber(INVENTORY_ANIMATION);
    integer num = llGetInventoryNumber(INVENTORY_ANIMATION);
   
   
    for (i = 0; i < num; ++i) {
    for (i = 0; i < num; ++i) {
        ObjectName = llGetInventoryName(INVENTORY_ANIMATION, i);
        ObjectName = llGetInventoryName(INVENTORY_ANIMATION, i);
        if (llGetInventoryPermMask(ObjectName, MASK_NEXT) & PERM_COPY) {
        if (llGetInventoryPermMask(ObjectName, MASK_NEXT) & PERM_COPY) {
            perms_copy = "Copy";
            perms_copy = "Copy";
            }
            }
        if (llGetInventoryPermMask(ObjectName, MASK_NEXT) & PERM_TRANSFER) {
        if (llGetInventoryPermMask(ObjectName, MASK_NEXT) & PERM_TRANSFER) {
            perms_xfer = "Transfer";
            perms_xfer = "Transfer";
            }
            }
        if ( ( perms_copy == "Copy") && (perms_xfer == "Transfer") ) {
        if ( ( perms_copy == "Copy") && (perms_xfer == "Transfer") ) {
            WarningList += ObjectName + ": " + perms_copy + " " + perms_xfer;
            WarningList += ObjectName + ": " + perms_copy + " " + perms_xfer;
        }
        }
        perms_copy = "";
        perms_copy = "";
        perms_xfer = "";
        perms_xfer = "";
    }
    }
    integer WarningNum = llGetListLength(WarningList);
    integer WarningNum = llGetListLength(WarningList);
    if (WarningNum == 0) {
    if (WarningNum == 0) {
        llSay(0, "All animation permissions are correct!");
        llSay(0, "All animation permissions are correct!");
        return;
        return;
    }
    }
    else {
    else {
        for (i = 0; i < WarningNum; ++i) {
        for (i = 0; i < WarningNum; ++i) {
            string tmp01 = llList2String(WarningList, i);
            string tmp01 = llList2String(WarningList, i);
            llSay(0,tmp01);
            llSay(0,tmp01);
        }
        }
    }
    }
    WarningList = [];
    WarningList = [];
}
  }
   
   
   
   
  default {
  default {
    state_entry() {
    state_entry() {
        checkPerms();
        checkPerms();
    }
    }
      
      
    on_rez(integer params) {
    on_rez(integer params) {
        llResetScript();
        llResetScript();
    }
    }
      
      
    touch_start(integer start) {
    touch_start(integer start) {
      checkPerms();
        checkPerms();
    }
    }
}
 
----
 
Here's an alternative implementation of the same idea.
 
// Drop this script in any prim that contains animations to check the their permissions.
// Prints a warning for each animation that is copy/xfer for next owner.
// Prints a warning if you've mixed no-copy and no-xfer anims, and lists the exceptions.
// Lists any modifiable animations.
// Deletes itself when done.
//
// Lear Cale, based on code by Chaz Longstaff, June 2008.
checkPerms() {
    integer ix;
    integer perms;
    integer numWarnings;
    string  anim;
    list    copy;
    list    xfer;
    list    mod;
   
    llSay(0, "Checking that anims are not copy/xfer for next owner");
    integer num = llGetInventoryNumber(INVENTORY_ANIMATION);
 
    for (ix = 0; ix < num; ++ix) {
        anim = llGetInventoryName(INVENTORY_ANIMATION, ix);
        perms = llGetInventoryPermMask(anim, MASK_NEXT);
       
        if ((perms & PERM_COPY) && (perms & PERM_TRANSFER)) {
            llSay(0, "'" + anim + "' is copy/xfer");
            ++numWarnings;
        } else {
            if (perms & PERM_COPY) {
                copy += anim;
            }
            if (perms & PERM_TRANSFER) {
                xfer += anim;
            }
            if (perms * PERM_MODIFY) {
                mod += anim;
            }
        }
    }
   
    integer numCopy = llGetListLength(copy);
    integer numXfer = llGetListLength(xfer);
   
    if (numCopy && numXfer) {
        llSay(0, "Warning: you've mixed no-copy and no-xfer anims");
        if (numCopy < numXfer) {
            llSay(0, "Copy/no-xfer anims: " + llList2CSV(copy));
        } else {
            llSay(0, "Xfer/no-copy anims: " + llList2CSV(xfer));
        }
    }
   
    if (llGetListLength(mod)) {
        llSay(0, "Modifiable anims: " + llList2CSV(mod));
    }
  }
  }
default {
    state_entry() {
        checkPerms();
        llRemoveInventory(llGetScriptName());
    }
}
----

Revision as of 06:41, 14 July 2008

Purpose: a tool to check that animations have correct the permissions for the next owner.

Catches errors that tired eyes may miss!

The logic is based on the assumption that full perms you have licenced should never have both copy and transfer enabled, only one or the other.

Copy the text below the line into a script, and follow the directions below.


//Purpose: a tool to check that animations have correct the permissions for the next owner
//The logic is based on the assumption that full perms you have licenced
//should never have both copy and transfer enabled, only one or the other.
//Confirms to you if all is well; lets you know what the problem ones are otherwise.
//Drop into the prim holding your MLPV2 when you have finished set up.
//Correct any errors.
//Then click the prim to check one more time; correct any errors then repeat until you get all is well msg.
//Then delete this script; customers don't need it, and the SL backend server doesn't need
//yet another running script to be monitoring in SIMs. Plus, customers would get a msg from it
//each time they clicked the prim, which would confuse them.
//Chaz Longstaff. June 2008.
checkPerms() {
    string perms_copy;
    integer i;
    string perms_xfer;
    string ObjectName;
    list WarningList = [];
    integer num = llGetInventoryNumber(INVENTORY_ANIMATION);

    for (i = 0; i < num; ++i) {
        ObjectName = llGetInventoryName(INVENTORY_ANIMATION, i);
        if (llGetInventoryPermMask(ObjectName, MASK_NEXT) & PERM_COPY) {
            perms_copy = "Copy";
            }
        if (llGetInventoryPermMask(ObjectName, MASK_NEXT) & PERM_TRANSFER) {
            perms_xfer = "Transfer";
            }
        if ( ( perms_copy == "Copy") && (perms_xfer == "Transfer") ) {
            WarningList += ObjectName + ": " + perms_copy + " " + perms_xfer;
        }
        perms_copy = "";
        perms_xfer = "";
    }
    integer WarningNum = llGetListLength(WarningList);
    if (WarningNum == 0) {
        llSay(0, "All animation permissions are correct!");
        return;
    }
    else {
        for (i = 0; i < WarningNum; ++i) {
            string tmp01 = llList2String(WarningList, i);
            llSay(0,tmp01);
        }
    }
    WarningList = [];
 }


default {
    state_entry() {
        checkPerms();
    }
   
    on_rez(integer params) {
        llResetScript();
    }
   
    touch_start(integer start) {
        checkPerms();
    }
}

Here's an alternative implementation of the same idea.

// Drop this script in any prim that contains animations to check the their permissions.
// Prints a warning for each animation that is copy/xfer for next owner.
// Prints a warning if you've mixed no-copy and no-xfer anims, and lists the exceptions.
// Lists any modifiable animations.
// Deletes itself when done.
//
// Lear Cale, based on code by Chaz Longstaff, June 2008.

checkPerms() {
    integer ix;
    integer perms;
    integer numWarnings;
    string  anim;
    list    copy;
    list    xfer;
    list    mod;
    
    llSay(0, "Checking that anims are not copy/xfer for next owner");

    integer num = llGetInventoryNumber(INVENTORY_ANIMATION);
 
    for (ix = 0; ix < num; ++ix) {
        anim = llGetInventoryName(INVENTORY_ANIMATION, ix);
        perms = llGetInventoryPermMask(anim, MASK_NEXT);
        
        if ((perms & PERM_COPY) && (perms & PERM_TRANSFER)) {
            llSay(0, "'" + anim + "' is copy/xfer");
            ++numWarnings;
        } else {
            if (perms & PERM_COPY) {
                copy += anim;
            }
            if (perms & PERM_TRANSFER) {
                xfer += anim;
            }
            if (perms * PERM_MODIFY) {
                mod += anim;
            }
        }
    }
    
    integer numCopy = llGetListLength(copy);
    integer numXfer = llGetListLength(xfer);
    
    if (numCopy && numXfer) {
        llSay(0, "Warning: you've mixed no-copy and no-xfer anims");
        if (numCopy < numXfer) {
            llSay(0, "Copy/no-xfer anims: " + llList2CSV(copy));
        } else {
            llSay(0, "Xfer/no-copy anims: " + llList2CSV(xfer));
        }
    }
    
    if (llGetListLength(mod)) {
        llSay(0, "Modifiable anims: " + llList2CSV(mod));
    }
}


default {
    state_entry() {
        checkPerms();
        llRemoveInventory(llGetScriptName());
    }
}