Enzeroizer (Rotation Fixer) ( V3 )

Written by Kitsune

Drop this into the root of your linked object and it will self seed to all links in a set (object). After re-rezzing the object and setting the scripts running it will set the rotations to whatever they were but with the smallest 3 decimal places made 000.

 

    https://d1yjxggot69855.cloudfront.net/skins/monobook/bullet.gif); color: rgb(0, 0, 0); font-family: verdana, helvetica, sans-serif; font-size: 13px; background-color: rgb(255, 255, 255); ">
  • E.g. <75.458392, 128,038754, 298.836580> will become <75.458000, 128,038000, 298.836000>.

This will make minor rotational drifts that occur due to one of our favorite bugs less of an issue. I have done light testing and think it's fine. Make a copy of your object before using this script just in case it goes wrong.

// V3 //
 
SelfSeed() // The function name.
{
    string name = llGetScriptName(); // Store the name of this script to save calling for it over and over.
    integer links_in_set = llGetObjectPrimCount(llGetKey()); // Store how many links there are.
    integer count = 2; // Establish a counter that will start at the next link in the set.
    do // This is the point from which we loop if the while condition is met.
    llGiveInventory(llGetLinkKey(count), name); // Deliver a copy of this script to the link number "count".
    while((++count) <= links_in_set); // Increment "count" and check if it is still less than or equal to the number of links.
} // If "count" is not more than the number of links loop back to "do".
 
float Float(float f) // The function name and the float data it carries.
{
    return ((float)(llDeleteSubString(((string)f), -3, -1) + "000")); // Typecast the delivered float to a string.
                                                                      // Chop the last 3 characters off the string and add 3 zeros.
                                                                      // Then typecast the result to a float and return it.
}
 
Enzeroize() // The function name.
{
    vector rot = (llRot2Euler(llGetLocalRot())*RAD_TO_DEG); // Store the local rotation of the prim as a vector.
    // Below : Take each of the axes (X, Y & Z) and feed to the "Float()" function then convert the vector to a rotation and set it.
    llSetLocalRot(llEuler2Rot(*DEG_TO_RAD));
}
 
default // Create a state.
{
    state_entry() // On entering the state...
    {
        if(llGetLinkNumber() == 1) // ...Check if we are the root of a LINK_SET.
        {
            SelfSeed(); // Call the "SelfSeed()" function.
            Enzeroize(); // Call the "Enzeroize()" function.
            // Below : Issue instructions in chat to the owner of the object.
            llOwnerSay("\nTake me to your inventory and re-rez me." +
                       "\nThen open an edit on me and goto your \"Tools\" menu." +
                       "\nNear the bottom of the menu click \"Set Scripts Running In Selection\"." +
                       "\nAll the scripts will self delete after Enzeroizing.");
        }
        else // If not in the root or if not in a LINK_SET...
        Enzeroize(); // ...Call the "Enzeroize()" function.
        llRemoveInventory(llGetScriptName()); // Whether in the root or not, this script removes itself from the prim.
    }
}