Difference between revisions of "RandColorwTimer"

From Second Life Wiki
Jump to navigation Jump to search
(Created page with "<lsl> integer zmienna=3; default { state_entry() { llSetTimerEvent(0.1); // Szybkosc zmiany } timer() { float r = llFrand(1); float g = llFrand(1); float b = ll…")
 
(Simplify)
 
Line 24: Line 24:


//Napisane przez Xintar Citron
//Napisane przez Xintar Citron
</lsl>
Creating 2 sets of random local floats on each cycle and only using one set (while discarding the other set) is pointless. Just do this:-
<lsl>
default
{
    state_entry()
    {
        llSetTimerEvent(0.1);
    }
    timer()
    {
        llSetLinkPrimitiveParamsFast(LINK_SET, [PRIM_COLOR, ALL_SIDES, < llFrand(1), llFrand(1), llFrand(1) >, 1.0 ] );
    }
}
</lsl>
</lsl>

Latest revision as of 03:51, 21 January 2013

<lsl> integer zmienna=3;

default {

state_entry() {
llSetTimerEvent(0.1); // Szybkosc zmiany
}
timer() {
   float r = llFrand(1);
   float g = llFrand(1);
   float b = llFrand(1);
   float r2 = llFrand(1);
   float g2 = llFrand(1);
   float b2 = llFrand(1);
if(zmienna==1) { // warunek
++zmienna; 

llSetLinkPrimitiveParamsFast(LINK_SET, [PRIM_COLOR,ALL_SIDES, <r,g,b>, 1.0]); // Wartosc pierwsza

} else { 
zmienna=1;

llSetLinkPrimitiveParamsFast(LINK_SET, [PRIM_COLOR,ALL_SIDES, <r2,g2,b2>,1.0]); // Wartosc druga

} 
}

}

//Napisane przez Xintar Citron

</lsl> Creating 2 sets of random local floats on each cycle and only using one set (while discarding the other set) is pointless. Just do this:-

<lsl> default {

   state_entry()
   {
       llSetTimerEvent(0.1);
   }
   timer()
   {
       llSetLinkPrimitiveParamsFast(LINK_SET, [PRIM_COLOR, ALL_SIDES, < llFrand(1), llFrand(1), llFrand(1) >, 1.0 ] );
   }

} </lsl>