Jump to content

how do i stop the loop?


Rhemah
 Share

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

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

Recommended Posts

what i really wanted to happen is have the glow value turn from 0.0 to 1.0 to 0.0 then stop.

float FADE_PERIOD = 6.0;
float TIMER_PERIOD = 0.25;

float MIN_GLOW = 0.0;
float MAX_GLOW = 1.0;

float glowAtTime(float t)
{
   float midPoint = 0.5*(MAX_GLOW+MIN_GLOW);
   float amplitude = 0.5*(MAX_GLOW-MIN_GLOW);

   return midPoint+amplitude*llSin(TWO_PI*t/FADE_PERIOD);
}

default
{
   state_entry()
   {
      llSetTimerEvent(TIMER_PERIOD);
   }

   timer()
   {
      float glow = glowAtTime(llGetTime());
      llSetPrimitiveParams([ PRIM_GLOW, ALL_SIDES, glow ]);
   }
}

and can someone teach me what does ++ do or * do im a bit confuse

:matte-motes-confused:
Link to comment
Share on other sites

is it like this? but it doesnt work:matte-motes-crying:

timer()   {        float glow = glowAtTime(llGetTime());        llSetPrimitiveParams([ PRIM_GLOW, ALL_SIDES, glow ]);        if (glow >= 1.0){llSetTimerEvent(0.0);}   }
Link to comment
Share on other sites

here is a basic snippet you can play with to get it how ya like..?

SLPPF has no delay, and you stop before 1.0 and 0.0 so the compiler wont go out of bounds.

 

integer k;
float x;
integer tog = 1;
float gap = 0.1;
integer flag;
default
{
    state_entry()
    {    
    }
    touch_start(integer total_number)
    {  llSetTimerEvent(gap);
    }
    timer()
    {    x +=  0.05 * tog;
         llSetLinkPrimitiveParamsFast(LINK_THIS,[PRIM_GLOW, ALL_SIDES,x]);
          if(x >= 0.95)
         { tog = -tog;
           flag = 1;
         }
         if(x <= 0.05 && flag == 1)
         {  x = 0.0;
              tog = 1;
              flag = 0;
              llSetLinkPrimitiveParamsFast(LINK_THIS,[PRIM_GLOW, ALL_SIDES,x]);
              llSetTimerEvent(0);
           
         }
    }
        
}

  • Like 1
Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 3228 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...