Jump to content

Glow blinker script (car blinker)


Timothey Timmerman
 Share

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

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

Recommended Posts

So i was looking for a script that made a script blink like a car blinker.

integer faceNo = -1;            // face number or -1 for ALL SIDES
float   timerDelay = 0.85;      // the time for glow/notglow
float   glowAmount = 0.2;       // 0.2 means 20%
///
integer isOn;

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

    timer()
    {
        isOn = !isOn;
        if( isOn ) llSetLinkPrimitiveParamsFast( LINK_THIS,[PRIM_GLOW,faceNo,glowAmount] );
        else llSetLinkPrimitiveParamsFast( LINK_THIS,[PRIM_GLOW,faceNo,0.0] );
    }    
}

You are welcome :)

Edited by Timothey Timmerman
  • Like 1
  • Thanks 1
Link to comment
Share on other sites

  • Timothey Timmerman changed the title to Glow blinker script (car blinker)
  • 1 month later...

You can make your blinker more efficient by cleverly using animated textures:

integer isBlinking = TRUE;
default
{
    state_entry()
    {
        llSetTextureAnim(ANIM_ON|LOOP,3,2,1,0,2,7);
    }

    touch_start(integer total_number)
    {
        isBlinking=!isBlinking;
        if(isBlinking)
        {   llSetTextureAnim(ANIM_ON|LOOP,3,2,1,0,2,7);
        }
        else
        {   // second animation frame:
            llSetTextureAnim(ANIM_ON,3,2,1,1,1,1);
        }
    }
}

(I'd do well to replace literals with variables but I'm lazy.)

using a texture like 44fb09ab-b299-f68f-fa59-f3a7170152c8 which is half black and half white, and setting the color and glow via the build window.

  • Like 1
Link to comment
Share on other sites

  • 2 weeks later...
On 11/18/2021 at 8:11 AM, Quistess Alpha said:

You can make your blinker more efficient by cleverly using animated textures:

integer isBlinking = TRUE;
default
{
    state_entry()
    {
        llSetTextureAnim(ANIM_ON|LOOP,3,2,1,0,2,7);
    }

    touch_start(integer total_number)
    {
        isBlinking=!isBlinking;
        if(isBlinking)
        {   llSetTextureAnim(ANIM_ON|LOOP,3,2,1,0,2,7);
        }
        else
        {   // second animation frame:
            llSetTextureAnim(ANIM_ON,3,2,1,1,1,1);
        }
    }
}

(I'd do well to replace literals with variables but I'm lazy.)

using a texture like 44fb09ab-b299-f68f-fa59-f3a7170152c8 which is half black and half white, and setting the color and glow via the build window.

No timer event, i approve. Indeed way more efficient :)  

  • Like 1
Link to comment
Share on other sites

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