Simple Cleanup Script

Expired

This script deletes all scripts in an object, including itself.

 

// Delete all scripts in an object

integer lhook;
list scripts;

alInit(integer argi)
{
    if (lhook)
    {
        llListenRemove(lhook);
    }
    integer num = llGetInventoryNumber(INVENTORY_SCRIPT);
    integer i;
    for (i = 0; i 

 

1-4 Script Resizer

Expired

key kOwner;
integer iLinkAmount;
integer iScriptAmount=1;
integer iScriptID=1;
integer iTemp;
integer iTemp2;
integer iListener;
integer iCurrentSize=100;
integer iFlags; // 1 - setup done, 2 - setting up, 4 - resizing, 8 - listening, 16 - added
string sScript;
list lTemp;
list lButtons=["Delete","Reset","Size","Custom","+25","-25","+10","-10","+5","-5","+1","-1"];
vector vTemp;
setFlag(integer flag)
{
    if(!(iFlags & flag))
       iFlags+=flag; 
}
unsetFlag(integer flag)
{
    if(iFlags & flag)
       iFlags-=flag; 
}
doResize(integer percentage)
{
    setFlag(4);
    if(iScriptID==1)
        llMessageLinked(LINK_THIS,12121,(string)percentage,NULL_KEY);
    vTemp=llGetPos();
    ;
    if(!(iTemp2=((iTemp=(llCeil((float)iLinkAmount / (float)iScriptAmount))*iScriptID)) - llCeil((float)iLinkAmount / (float)iScriptAmount)))
        iTemp2=1;
    if(percentage != 0)
    {
        iCurrentSize=percentage+iCurrentSize;
        if(iScriptID==1)
            llOwnerSay("Resizing to: "+(string)iCurrentSize+"% ("+(string)percentage+"%)");
    }
    else
    {
        iCurrentSize=100;
        if(iScriptID==1)
            llOwnerSay("Resetting size.");
    }    
    do
    {
        llSetLinkPrimitiveParams(iTemp,[PRIM_POSITION,(((vector)llList2String(lTemp=llParseString2List(llList2String(llGetObjectDetails(llGetLinkKey(iTemp),[OBJECT_DESC]),0),["#"],[""]),1))/100)*iCurrentSize,PRIM_SIZE,((((vector)llList2String(lTemp,0))/100)*iCurrentSize)]);
    }
    while((iTemp=~-iTemp) != iTemp2);
    if(iTemp2==1)
    {
        llSetScale((((vector)llList2String(llParseString2List(llList2String(llGetObjectDetails(llGetLinkKey(iTemp),[OBJECT_DESC]),0),["#"],[""]),0))/100)*iCurrentSize);
        if(!percentage)
            llOwnerSay("Resize operation finished. Object resized to original scale.");
        else
            llOwnerSay("Resize operation finished. Object resized to "+(string)(iCurrentSize)+"%");
    }
    unsetFlag(4);
}
default
{
    state_entry()
    {
        if((iLinkAmount=llGetObjectPrimCount(llGetKey())) > 1)
        {
            if(llGetLinkNumber() > 1)
            {
                llSetObjectDesc((string)llGetScale()+"#"+(string)llGetLocalPos());
                llMessageLinked(LINK_ROOT,45454,"",NULL_KEY);
                llRemoveInventory(llGetScriptName());
            }
            else
            {
                llMessageLinked(LINK_THIS,34343,"",NULL_KEY);
                llOwnerSay("Please wait...");
                llSetTimerEvent(2);
                kOwner=llGetOwner();
                sScript=llGetScriptName();
            }
        }
    }
    on_rez(integer foo)
    {
        if(kOwner!=llGetOwner())
            kOwner=llGetOwner();
    }
    changed(integer change)
    {
        if(change & CHANGED_OWNER)
            kOwner=llGetOwner();
        else if(change & CHANGED_LINK)
        {
            if(iScriptID!=1)
                llRemoveInventory(sScript);
            else if(iFlags)
            {
                llOwnerSay("Changed link configuration. Resetting myself.");
                llResetScript();
            }
        }
    }
    touch_start(integer foo)
    {
        if(iScriptID==1)
        {
            if(iFlags & 8)
            {
                llSetTimerEvent(0);
                llListenRemove(iListener);
                unsetFlag(8);
            }
            if(iFlags & 1)
            {
                setFlag(8);
                iListener=llListen(iTemp=llFloor(llFrand(2137483647)+10000000),"",kOwner,"");
                llDialog(kOwner,"Choose:",lButtons,iTemp);
                llSetTimerEvent(10);
            }
        }
    }
    link_message(integer sender, integer num, string str,key id)
    {
        if(num==34343 && iFlags)
        {
            ++iScriptAmount;
            llMessageLinked(LINK_THIS,23232,"",NULL_KEY);
        }
        if(num==12121 && !(iFlags & 4) && iScriptID!=1)
            doResize((integer)str);
        else if(num == 23232 && !(iFlags & 16))
        {
            if((iScriptID=-~iScriptID) >4)
            {
                llOwnerSay("There are already 4 resize scripts in the object. Deleting myself.");
                llMessageLinked(LINK_THIS,78787,"",NULL_KEY);
                llRemoveInventory(sScript);
            }
            else
                llSetTimerEvent(2);
        }
        else if((num==45454) && (iScriptID == 1))
        {
            if(iFlags & 2)
                if((iTemp=-~iTemp)==(iLinkAmount-1))
                {
                    setFlag(1);
                    llOwnerSay("The resizer is set up and ready to use. The current object will take approximately "+(string)(iLinkAmount*0.2)+" seconds to resize.");
                    llOwnerSay("Add more copies of this script to the object to speed up the operation. Touch the object to get a menu.");
                }
        }
        else if(num==67676)
            llRemoveInventory(sScript);
        else if(num==78787)
            iScriptAmount=~-iScriptAmount;
    }
    listen(integer channel,string name, key id, string message)
    {
        if(iFlags & 8)
        {
            if(iTemp==1)
            {
                llSetTimerEvent(0);
                llListenRemove(iListener);
                doResize((integer)message);
            }
            else if((iTemp=llListFindList(lButtons,[message])) != -1)
            {
                llSetTimerEvent(0);
                llListenRemove(iListener);
                if(!iTemp)
                {
                    llOwnerSay("Deleting resizer.");
                    llMessageLinked(LINK_THIS,67676,"",NULL_KEY);
                    llRemoveInventory(sScript);
                }
                else if(iTemp==1)
                    doResize(0);
                else if(iTemp==2)
                    llOwnerSay("Current size is: "+(string)iCurrentSize+"%");
                else if(iTemp==3)
                {
                    llOwnerSay("Say your custom size offset in percent on channel 1.");
                    iListener=llListen(iTemp=1,"",kOwner,"");
                }
                else
                    doResize((integer)message);
            }
        }
    }
    timer()
    {
        llSetTimerEvent(0);
        if(!iFlags)
        {

            if(iScriptID == 1)
            {
                setFlag(2);
                setFlag(16);
                llOwnerSay("Spreading temporary scripts in object's prims. Please wait til the process finishes...");
                iTemp=iLinkAmount;
                do
                    llGiveInventory(llGetLinkKey(iTemp),sScript);
                while(iTemp=~-iTemp);
                llSetObjectDesc((string)llGetScale()+"#"+(string)llGetLocalPos());
                llOwnerSay("Scripts spread. Please take this object into inventory, rez or wear it again, and select 'tools -> set all scripts to running in selection'");
            }
            else
            {
                setFlag(16);
                llOwnerSay((string)(iScriptAmount=iScriptID)+" resize scripts inserted. It will take approximately "+(string)((iLinkAmount * 0.2) / iScriptID)+" seconds to resize the object now.");
            }
        }
        else
        {
            llListenRemove(iListener);
            setFlag(1);
            llOwnerSay("Menu timed out.");
        }
    }
}

 

Small Prim Fix

Expired

A rewrite of a script to help avatars with worn items such as belts, etc. "It looks for any prim in a linkset that can't be shrunk any more and enlarges it slightly, thus allowing you to take the whole linkset down in size a bit more."

 

/*based on the wonderful script, Fix Small Prims by Emma Nowhere, http://wiki.secondlife.com/wiki/Fix_Small_Prims, updated by Innula Zenovka to use llGetLinkPrimitiveParams and llSetLinkPrimitiveParamsFast. 
  
Issued under the "do what the hell you like with it, but you if you scam people by selling it on its own I shall be so cross" licence 
This works by finding all prims in a linkset that can't be shrunk any further and, when you click "fix", slightly increasing the size on any axis that's at the minimun, this allowing you to shrink them some more.    Click "rerun" if you hit the minimun size again, to find the small prims again, and then click "fix" to fix them.   Click Delete Script when you are done*/
list options =["Fix", "Delete Script", "ReRun"];
list start_scale;
list to_fix;
integer i;
integer max;
integer rescaleX = FALSE;
integer rescaleY = FALSE;
integer rescaleZ = FALSE;
integer chan;
vector scale;
integer fncStrideCount(list lstSource, integer intStride)
{
  return llGetListLength(lstSource) / intStride;
}
// Returns a Stride from a List
list fncGetStride(list lstSource, integer intIndex, integer intStride)
{
  integer intNumStrides = fncStrideCount(lstSource, intStride);
  if (intNumStrides != 0 && intIndex 

 

Rezzer

Expired

 

Written by Innula Zenovka

 

To make this work, set up the rezzer at whatever rotation you want, and place the object you want to rez at the correct relative position. You can either then read their respective positions and rotations by dropping the following simple script into each one and copy-pasting the results into the main script, or, if prefer, you can just read the numbers from the rotation boxes in the prims' edit windows and let the script convert the vector to rotation. 

Either way, enter them in the rezzer script, and there you are.

 

 

//Sample rezzer script by Innula Zenovka Jan 27 2010
// released under the "do what the hell you want with it" licence

vector rezzer_pos = <68 .4949, 151.2232, 25.6000>;  // the position of the rezzer when first you set it up
rotation rezzer_rot; // you could read the rotation by script, enter it here and comment out the next line
vector rezzer_rot_window = <180 .05,0.00,52.00>;  // the numbers in the rotation box in the edit window

vector child_pos = <133 .67170, 156.75260, 1751.52900> ; // the position of the rezzed object at first set up
rotation child_rot;// you could read the rotation by script, enter it here and comment out the next line
vector child_rot_window =<320 .25,11.05,257.00>;// the numbers in the rotation box in the edit window

vector offset;
default
{
    state_entry()
    {
        
        rezzer_rot = llEuler2Rot(rezzer_rot_window*DEG_TO_RAD); 
        // you could comment this out and use the following line, to which it is equivalent
        // rezzer_rot = <-0.50000, -0.50000, 0.50000, 0.50000>;
        child_rot = llEuler2Rot(child_rot_window*DEG_TO_RAD);
         // you could comment this out and use the following line, to which it is equivalent
        //child_rot =<0.27363, 0.39548, 0.12470, 0.86785>;
        offset = offset/rezzer_rot;
    }

    touch_start(integer total_number)
    {
        llRezAtRoot(llGetInventoryName(INVENTORY_OBJECT,0),
        llGetPos()+offset*llGetRot(),
        ZERO_VECTOR,
        (child_rot/rezzer_rot)*llGetRot(), 
        99);
    }
}

 

 

The Helper Script:

 

//reads position and rotation
default
{
    state_entry()
    {
        llOwnerSay((string)llGetPos()+" "+(string)llGetRot());
        llRemoveInventory(llGetScriptName());
    }

  
}