Jump to content

Need Help with a flickering script


MaxNobaru
 Share

Recommended Posts

So tried looking in the forums but didnt see anything similar and im not great at scripting, if anyone could help pls

i need to change the color of this flicker to the color of the prim itself as yall can see it uses the vector, and i couldnt figure out how to change it

default
{
    state_entry()
    {
        llSetTimerEvent(0.20);
    }
    timer()
    {
        llSetLinkPrimitiveParamsFast (llGetLinkNumber() , [ PRIM_COLOR, ALL_SIDES , <1,1,1> , llFrand(10)]) ;
    }
}

Link to comment
Share on other sites

yes it uses the vector, but i need it to use the color the prim is using, as im going to use a color changer with it, so everytime i change te color, it just turns back to white or wtv color the vector is saying, thats wat i need to change

Link to comment
Share on other sites

I usually recommend using texture animation for a blinking effect rather than setting the color on a timer. A simple example of that with touch to turn on/off is:

integer isBlinking = TRUE;
integer face = ALL_SIDES;
key texture = "44fb09ab-b299-f68f-fa59-f3a7170152c8";
default
{
    state_entry()
    {   llSetTexture(texture,face);
        llSetTextureAnim(ANIM_ON|LOOP,face,2,1,0,2,7);
    }
    touch_start(integer total_number)
    {   isBlinking=!isBlinking;
        if(isBlinking)
        {   llSetTextureAnim(ANIM_ON|LOOP,ALL_SIDES,2,1,0,2,7);
        }
        else
        {   // second animation frame:
            llSetTextureAnim(ANIM_ON,3,2,1,1,1,1);
        }
    }
}

The main advantages being that it's more efficient, and the color doesn't need to be set by the script, it can be whatever color the face is set to. (as long as you use a white/black texture that is. If one of the colors is non-black, you'd need a custom texture per color combo)

  • Like 2
Link to comment
Share on other sites

15 minutes ago, MaxNobaru said:

yes it uses the vector, but i need it to use the color the prim is using, as im going to use a color changer with it, so everytime i change te color, it just turns back to white or wtv color the vector is saying, thats wat i need to change

have a look at llGetColor

https://wiki.secondlife.com/wiki/LlGetColor

this will get the color of the prim which can then be applied in your timer event

to get  you started with the basics then something like:

timer()
{
   vector color = llGetColor(ALL_SIDES);
   llSetColor(color, ALL_SIDES);
}

once you get the hang of this then you can move to getting and setting the color of linked prims and individual faces using

https://wiki.secondlife.com/wiki/LlGetPrimitiveParams

and the Set Primitive function in your script

 

edit add

but yes as Tessa says above. If you just want it to blink then texture animation can be the way to go

Edited by elleevelyn
  • Like 2
Link to comment
Share on other sites

32 minutes ago, Quistess Alpha said:

I usually recommend using texture animation for a blinking effect rather than setting the color on a timer. A simple example of that with touch to turn on/off is:

integer isBlinking = TRUE;
integer face = ALL_SIDES;
key texture = "44fb09ab-b299-f68f-fa59-f3a7170152c8";
default
{
    state_entry()
    {   llSetTexture(texture,face);
        llSetTextureAnim(ANIM_ON|LOOP,face,2,1,0,2,7);
    }
    touch_start(integer total_number)
    {   isBlinking=!isBlinking;
        if(isBlinking)
        {   llSetTextureAnim(ANIM_ON|LOOP,ALL_SIDES,2,1,0,2,7);
        }
        else
        {   // second animation frame:
            llSetTextureAnim(ANIM_ON,3,2,1,1,1,1);
        }
    }
}

The main advantages being that it's more efficient, and the color doesn't need to be set by the script, it can be whatever color the face is set to. (as long as you use a white/black texture that is. If one of the colors is non-black, you'd need a custom texture per color combo)

i was going to use a blank texture already, so it works out just fine, thank you so much

  • Like 2
Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...