Enzeroizer (Rotation Fixer) ( V3 )

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.
    }
}

 

Add a comment

Easy Object Rotation

//////////CHANGE THESE SETTINGS////////////////////
string speed = "NORMAL"; //"VERY SLOW", "SLOW", "NORMAL", "FAST", "VERY FAST"
string direction = "FORWARD"; //"FORWARD", "REVERSE"
////////////////END SETTINGS///////////////////////

default
{
    state_entry()
    {
        vector speedvector = <0,0,0.6>;
        if (speed == "VERY SLOW")
        {
           speedvector = <0,0,0.15>;
        }
        else if (speed == "SLOW")
        {
           speedvector = <0,0,0.3>;
        }
        else if (speed == "NORMAL")
        {
           speedvector = <0,0,0.6>;
        }
        else if (speed == "FAST")
        {
           speedvector = <0,0,1>;
        }
        else if (speed == "VERY FAST")
        {
           speedvector = <0,0,5>;
        }
        if (direction == "REVERSE")
        {
            speedvector.z *= -1;
        }
        llOwnerSay("Object is rotating " + direction + " " + speed + ".");
        llTargetOmega(speedvector,PI,1.0);
    }
}

 

Add a comment

Rotate On Click

integer switch = TRUE;
integer count = 0;
 
default
{
    state_entry()
    {
        llPlaySound("2df2a3b9-9b73-9f90-75e1-9cd98e9a713d",1.0);
        llSay(0,"WaterWheel Pulley Initialized");
    }
 
on_rez(integer start_param)
    {
       llResetScript();
    }
 
    touch_start(integer total_number)
    {
        if (llDetectedKey(0) == llGetOwner())
        {
            if (switch == FALSE)
            {
            switch = TRUE;
            llSay(0,"Started");
            llTriggerSound("091402dc-f0ea-81d4-6ca0-728649a1c0c5",1.0);
            llTargetOmega(<0,0.2,0>,PI,1.0);
            } 
 
            else if (switch == TRUE)
 
            {
            switch = FALSE;
            llSay(0,"Stopped");
            llTriggerSound("091402dc-f0ea-81d4-6ca0-728649a1c0c5",1.0);
            llTargetOmega(<0,0,0>,PI,1.0);
            }
        }
        else
         llInstantMessage(llDetectedKey(0),"Owner says no.");
    }
}

 

Add a comment