Jump to content

request for Rolig Loon


shaniqua Sahara
 Share

You are about to reply to a thread that has been inactive for 2688 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

I found this very cool script of yours Rolig. thank you for sharing:)

would you be able to modify it so that the child prims move only when the root prim is touched instead of any prim? I found a novel use for it and I'd love to use it if you can. this script is a lot of fun.

 

float fTimer = 10.0; //how long to go the entire distance
integer iSteps = 200; //how many steps to go from start to end
vector vAxis = <1.0,0.0,0.0>; //axis to move along. <1,0,0> is x-axis, <0,1,0> is y-axis, <0,0,1> is z-axis
integer iStep = 0; //control variable, don't change
integer k;  // ON/OFF switch
integer toggle; // Reverse direction of slide
list gHome;     // Starting positions of child prims

default
{    
    touch_start(integer num)
    {
        integer i;
        k = !k;
        if (k)
        {         //ON
            for (i=2;i<=llGetNumberOfPrims();++i) 
            {   //Loop to get the starting positions of all child prims
                gHome += [llList2Vector(llGetLinkPrimitiveParams(i,[PRIM_POS_LOCAL]),0)];
            }
            iStep = 0;  //Set slide position at zero
            llSetTimerEvent((fTimer/iSteps));
            llOwnerSay("on");
        }
        else
        {   //OFF
            for (i=2;i<=llGetNumberOfPrims();++i)
            {   //Loop to reposition all child prims at their starting positions
                llSetLinkPrimitiveParamsFast(i, [PRIM_POS_LOCAL, llList2Vector(gHome,i-2)]);
            }
            gHome = []; // Empty the home position vector list
            llSetTimerEvent(0);
            llOwnerSay("off");
            //  llResetScript();
        }
    }
    timer()
    { //remove un-changeable axis-parameters from scale
        vector vScale = llGetScale();
        if (vAxis.x == 0.0) {vScale.x = 0;}
        if (vAxis.y == 0.0) {vScale.y = 0;}
        if (vAxis.z == 0.0) {vScale.z = 0;}
        if (iStep >= iSteps)
        {
            toggle = -1;                       
        }
        
       else if (iStep <= 0)
        {
            toggle = 1;       
        }
        integer i;
        for (i=2;i<=llGetNumberOfPrims();++i)
        {   // Loop for all child prims
            llSetLinkPrimitiveParamsFast(i, [PRIM_POS_LOCAL, llList2Vector(gHome,i-2) + (vScale / iSteps)*iStep]);
            iStep = iStep + toggle; //add 1 or -1 to step
        }
    }
}

 

 

 

 

Link to comment
Share on other sites

ah that's an easy one. I added the bit to the script to check if it's the root being touched, and highlighted in red. Not in world to check, but should work


shaniqua Sahara wrote:

I found this very cool script of yours Rolig. thank you for sharing:)

would you be able to modify it so that the child prims move only when the root prim is touched instead of any prim? I found a novel use for it and I'd love to use it if you can. this script is a lot of fun.

 
float fTimer = 10.0; //how long to go the entire distanceinteger iSteps = 200; //how many steps to go from start to endvector vAxis = <1.0,0.0,0.0>; //axis to move along. <1,0,0> is x-axis, <0,1,0> is y-axis, <0,0,1> is z-axisinteger iStep = 0; //control variable, don't changeinteger k;  // ON/OFF switchinteger toggle; // Reverse direction of slidelist gHome;     // Starting positions of child primsdefault{        touch_start(integer num)    {

integer i; k = !k; if (k) { //ON for (i=2;i<=llGetNumberOfPrims();++i) { //Loop to get the starting positions of all child prims gHome += [llList2Vector(llGetLinkPrimitiveParams(i,[PRIM_POS_LOCAL]),0)]; } iStep = 0; //Set slide position at zero llSetTimerEvent((fTimer/iSteps)); llOwnerSay("on"); } else { //OFF for (i=2;i<=llGetNumberOfPrims();++i) { //Loop to reposition all child prims at their starting positions llSetLinkPrimitiveParamsFast(i, [PRIM_POS_LOCAL, llList2Vector(gHome,i-2)]); } gHome = []; // Empty the home position vector list llSetTimerEvent(0); llOwnerSay("off"); // llResetScript(); }
} timer() { //remove un-changeable axis-parameters from scale vector vScale = llGetScale(); if (vAxis.x == 0.0) {vScale.x = 0;} if (vAxis.y == 0.0) {vScale.y = 0;} if (vAxis.z == 0.0) {vScale.z = 0;} if (iStep >= iSteps) { toggle = -1; } else if (iStep <= 0) { toggle = 1; } integer i; for (i=2;i<=llGetNumberOfPrims();++i) { // Loop for all child prims llSetLinkPrimitiveParamsFast(i, [PRIM_POS_LOCAL, llList2Vector(gHome,i-2) + (vScale / iSteps)*iStep]); iStep = iStep + toggle; //add 1 or -1 to step } }}

 

 

 

 

 

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 2688 days.

Please take a moment to consider if this thread is worth bumping.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...