Kilt Editor

From Second Life Wiki
Revision as of 12:09, 12 October 2012 by Kireji Haiku (talk | contribs) (updated script)
Jump to navigation Jump to search

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>