Kilt Editor: Difference between revisions
Brangus Weir (talk | contribs) mNo edit summary |
Kireji Haiku (talk | contribs) 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 | integer softness = 1; | ||
float | float gravity = 0.3; | ||
float | float drag = 1.0; | ||
float | float wind = 0.0; | ||
float | float tension = 0.6; | ||
float | float forceX = 0.0; | ||
float | float forceY = 0.0; | ||
float | float forceZ = 0.0; | ||
// | //__/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/ | ||
//__/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/ | |||
integer GetNumberOfPrims() | |||
llOwnerSay(" | { | ||
if (llGetAttached()) | |||
return llGetNumberOfPrims(); | |||
list | return llGetObjectPrimCount(llGetKey()); | ||
integer | } | ||
updateFlexiParams() | |||
{ | |||
if (llList2Integer( | 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( | llOwnerSay("Done with updating flexi-params."); | ||
} | } | ||
default { | default | ||
on_rez(integer | { | ||
on_rez(integer start_param) | |||
} | { | ||
state_entry() { | updateFlexiParams(); | ||
} | |||
state_entry() | |||
{ | |||
updateFlexiParams(); | |||
} | } | ||
touch_start(integer | |||
touch_start(integer num_detected) | |||
{ | |||
updateFlexiParams(); | |||
} | } | ||
} | } | ||
</lsl> | </lsl> | ||
Revision as of 13:09, 12 October 2012
| LSL Portal | Functions | Events | Types | Operators | Constants | Flow Control | Script Library | Categorized Library | Tutorials |
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>