Difference between revisions of "Kilt Editor"

From Second Life Wiki
Jump to navigation Jump to search
m (updated script)
(Undo revision 1173338 by Kireji Haiku (Talk) which left the script in a non-compilable state)
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 softness    = 1;
integer gSoftness = 1;
float gravity      = 0.3;
float gGravity =   0.3;
float drag          = 1.0;
float gDrag =       1.0;
float wind          = 0.0;
float gWind =       0.0;
float tension      = 0.6;
float gTension =   0.6;
float forceX        = 0.0;
float gForceX =     0.0;
float forceY        = 0.0;
float gForceY =     0.0;
float forceZ        = 0.0;
float gForceZ =     0.0;


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


integer GetNumberOfPrims()
setParams() {
{
     llOwnerSay("soft: " + (string) gSoftness + " grav: " + (string) gGravity
    if (llGetAttached())
        + " drag: " + (string) gDrag + " wind: " + (string) gWind
        return llGetNumberOfPrims();
        + " tens: " + (string) gTension + " Force: <" + (string) gForceX + ","
 
        + (string) gForceY + "," + (string) gForceZ + ">");
    return llGetObjectPrimCount(llGetKey());
     list primparam = [];
}
     integer i = llGetNumberOfPrims();
 
     integer prims = 0;
updateFlexiParams()
     for (; i >= 0; --i) { // test each prim in link set
{
         primparam = llGetLinkPrimitiveParams(i,[PRIM_FLEXIBLE]);
     llOwnerSay("softness: " + (string)softness
         if (llList2Integer(primparam,0)) { // this is a flexi
            + "\ngravity: " + (string)gravity
             llSetLinkPrimitiveParams( i,
            + "\ndrag: " + (string)drag
                [PRIM_FLEXIBLE, TRUE, gSoftness, gGravity, gDrag, gWind, gTension,
            + "\nwind: " + (string)wind
                 < gForceX, gForceY, gForceZ > ]);
            + "\ntension: " + (string)tension
             prims++; // count the prims changed
            + "\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.");
     llOwnerSay( (string) prims + " prims were set.");
}
}


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

Revision as of 04:35, 18 February 2013

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 gSoftness = 1; float gGravity = 0.3; float gDrag = 1.0; float gWind = 0.0; float gTension = 0.6; float gForceX = 0.0; float gForceY = 0.0; float gForceZ = 0.0;

// DO NOT EDIT BELOW HERE

setParams() {

   llOwnerSay("soft: " + (string) gSoftness + " grav: " + (string) gGravity
       + " drag: " + (string) gDrag + " wind: " + (string) gWind
       + " tens: " + (string) gTension + " Force: <" + (string) gForceX + ","
       + (string) gForceY + "," + (string) gForceZ + ">");
   list primparam = [];
   integer i = llGetNumberOfPrims();
   integer prims = 0;
   for (; i >= 0; --i) { // test each prim in link set
       primparam = llGetLinkPrimitiveParams(i,[PRIM_FLEXIBLE]);
       if (llList2Integer(primparam,0)) { // this is a flexi
           llSetLinkPrimitiveParams( i,
               [PRIM_FLEXIBLE, TRUE, gSoftness, gGravity, gDrag, gWind, gTension,
               < gForceX, gForceY, gForceZ > ]);
           prims++;  // count the prims changed 
       } 
   }
   llOwnerSay( (string) prims + " prims were set.");

}

default {

   on_rez(integer x) {
       setParams();     
   } 
   state_entry() {
       setParams(); 
   }
   touch_start(integer total_number) {
       setParams();   
   }

} </lsl>