Difference between revisions of "Kilt Editor"

From Second Life Wiki
Jump to navigation Jump to search
m
m (updated script)
Line 5: Line 5:


<lsl>
<lsl>
// This sets all flexis in your link set to the parameters you program here.
// This sets all flexis in your link set to the parameters you program here.
// Note this will chage the params of EVERY flexi in your link set - so if you add  
// Note this will chage the params of EVERY flexi in your link set - so if you add
// tassles and junk, do that after you are happy with the basic skirt!
// tassles and junk, do that after you are happy with the basic skirt!
// You only need to put this into the root prim, and touch the link set,  
// You only need to put this into the root prim, and touch the link set,
// or save or reset the script -Brangus Weir
// or save or reset the script -Brangus Weir


integer gSoftness = 1;
integer softness    = 1;
float gGravity =   0.3;
float gravity      = 0.3;
float gDrag =       1.0;
float drag          = 1.0;
float gWind =       0.0;
float wind          = 0.0;
float gTension =   0.6;
float tension      = 0.6;
float gForceX =     0.0;
float forceX        = 0.0;
float gForceY =     0.0;
float forceY        = 0.0;
float gForceZ =     0.0;
float forceZ        = 0.0;


// DO NOT EDIT BELOW HERE
//__/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
//__/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/


setParams() {
integer GetNumberOfPrims()
     llOwnerSay("soft: " + (string) gSoftness + " grav: " + (string) gGravity
{
        + " drag: " + (string) gDrag + " wind: " + (string) gWind
    if (llGetAttached())
        + " tens: " + (string) gTension + " Force: <" + (string) gForceX + ","
        return llGetNumberOfPrims();
        + (string) gForceY + "," + (string) gForceZ + ">");
 
     list primparam = [];
    return llGetObjectPrimCount(llGetKey());
     integer i = llGetNumberOfPrims();
}
     integer prims = 0;
 
     for (; i >= 0; --i) { // test each prim in link set
updateFlexiParams()
         primparam = llGetLinkPrimitiveParams(i,[PRIM_FLEXIBLE]);
{
         if (llList2Integer(primparam,0)) { // this is a flexi
     llOwnerSay("softness: " + (string)softness
             llSetLinkPrimitiveParams( i,
            + "\ngravity: " + (string)gravity
                [PRIM_FLEXIBLE, TRUE, gSoftness, gGravity, gDrag, gWind, gTension,
            + "\ndrag: " + (string)drag
                 < gForceX, gForceY, gForceZ > ]);
            + "\nwind: " + (string)wind
             prims++; // count the prims changed
            + "\ntension: " + (string)tension
         }  
            + "\nforce: <" + (string)forceX + "," + (string)forceY + "," + (string)forceZ + ">");
 
    list oldParams;
     list newParams = [PRIM_FLEXIBLE, TRUE, softness, gravity,
                        drag, wind, tension, <forceX, forceY, forceZ>];
 
     integer link = GetNumberOfPrims();
     if (link == 1)
     {
        llOwnerSay("The flexi-params of one prim are being updated.");
         oldParams = llGetLinkPrimitiveParams(LINK_ROOT, [PRIM_FLEXIBLE]);
 
         if (llList2Integer(oldParams, 0))// is TRUE
            llSetLinkPrimitiveParamsFast(LINK_ROOT, newParams);
    }
    else//  is a linkset
    {
        llOwnerSay("The flexi-params of " + (string)link + " prims are being updated.");
        do
        {
             oldParams = llGetLinkPrimitiveParams(link, [PRIM_FLEXIBLE]);
 
            if (llList2Integer(primparam, 0))//  is TRUE
                 llSetLinkPrimitiveParamsFast(link, newParams);
 
             --link;
         }
        while (link);
     }
     }
     llOwnerSay( (string) prims + " prims were set.");
     llOwnerSay("Done with updating flexi-params.");
}
}


default {
default
     on_rez(integer x) {
{
         setParams();    
     on_rez(integer start_param)
     }  
    {
     state_entry() {
         updateFlexiParams();
         setParams();  
     }
 
     state_entry()
    {
         updateFlexiParams();
     }
     }
     touch_start(integer total_number) {
 
         setParams();  
     touch_start(integer num_detected)
    {
         updateFlexiParams();
     }
     }
}
}
</lsl>
</lsl>

Revision as of 12:09, 12 October 2012

Having spent too many hours editing the parameters of 35 flexi-prims on a kilt, and still not being pleased with the result, and starting all over again, it finally occured to me to write this little guy.


<lsl> // This sets all flexis in your link set to the parameters you program here. // Note this will chage the params of EVERY flexi in your link set - so if you add // tassles and junk, do that after you are happy with the basic skirt! // You only need to put this into the root prim, and touch the link set, // or save or reset the script -Brangus Weir

integer softness = 1; float gravity = 0.3; float drag = 1.0; float wind = 0.0; float tension = 0.6; float forceX = 0.0; float forceY = 0.0; float forceZ = 0.0;

//__/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/ //__/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/

integer GetNumberOfPrims() {

   if (llGetAttached())
       return llGetNumberOfPrims();
   return llGetObjectPrimCount(llGetKey());

}

updateFlexiParams() {

   llOwnerSay("softness: " + (string)softness
           + "\ngravity: " + (string)gravity
           + "\ndrag: " + (string)drag
           + "\nwind: " + (string)wind
           + "\ntension: " + (string)tension
           + "\nforce: <" + (string)forceX + "," + (string)forceY + "," + (string)forceZ + ">");
   list oldParams;
   list newParams = [PRIM_FLEXIBLE, TRUE, softness, gravity,
                       drag, wind, tension, <forceX, forceY, forceZ>];
   integer link = GetNumberOfPrims();
   if (link == 1)
   {
       llOwnerSay("The flexi-params of one prim are being updated.");
       oldParams = llGetLinkPrimitiveParams(LINK_ROOT, [PRIM_FLEXIBLE]);
       if (llList2Integer(oldParams, 0))//  is TRUE
           llSetLinkPrimitiveParamsFast(LINK_ROOT, newParams);
   }
   else//  is a linkset
   {
       llOwnerSay("The flexi-params of " + (string)link + " prims are being updated.");
       do
       {
           oldParams = llGetLinkPrimitiveParams(link, [PRIM_FLEXIBLE]);
           if (llList2Integer(primparam, 0))//  is TRUE
               llSetLinkPrimitiveParamsFast(link, newParams);
           --link;
       }
       while (link);
   }
   llOwnerSay("Done with updating flexi-params.");

}

default {

   on_rez(integer start_param)
   {
       updateFlexiParams();
   }
   state_entry()
   {
       updateFlexiParams();
   }
   touch_start(integer num_detected)
   {
       updateFlexiParams();
   }

} </lsl>