Jump to content
Sign in to follow this  
Rhemah

how do i stop the loop?

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

Share this post


Link to post
Share on other sites

And then you'll want a test in the timer event to llSetTimerEvent(0.0) if (glow >= 1.0), so that the timer doesn't keep chugging away and trying to increase glow beyond its upper limit.

Share this post


Link to post
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);}   }

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

thanks xiija, i'll play with this one and hope i can do something i want with my project :matte-motes-big-grin-wink:

Share this post


Link to post
Share on other sites
You are about to reply to a thread that has been inactive for 1881 days.

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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...