RandomPrimParams: Difference between revisions

From Second Life Wiki
Jump to navigation Jump to search
Created page with " integer int=3; default { state_entry() { llSetTimerEvent(0.1); // How fast repeat event } timer() { float r = llFrand(1); float g = llFrand(1); float b = llFra…"
 
m <lsl> tag to <source>
 
(4 intermediate revisions by 3 users not shown)
Line 1: Line 1:
integer int=3;
{{LSL Header}}{{LSLC|Examples}}
Simple script to show how to set random {{LSLGC|PrimitiveParams|primitive parameters}}.
default {
<source lang="lsl2">
state_entry() {
default
llSetTimerEvent(0.1); // How fast repeat event
{
}
    state_entry()
timer() {
    {
     float r = llFrand(1);
        // set timer to go off every other 5.0 seconds
     float g = llFrand(1);
        llSetTimerEvent(5.0);
    float b = llFrand(1);
    }
    float r2 = llFrand(1);
 
    float g2 = llFrand(1);
     timer()
    float b2 = llFrand(1);
     {
if(int==1)
        vector color = <llFrand(1.0), llFrand(1.0), llFrand(1.0)>;
++int;
 
llSetLinkPrimitiveParamsFast(LINK_SET, [PRIM_COLOR,ALL_SIDES, <r,g,b>, 1.0]); // You can use every PrimParams here like for example PRIM_GLOW
        // set random color on all sides of linkset with opaque as alpha value
} else {
        llSetLinkPrimitiveParamsFast(LINK_SET,
int=1;
            [PRIM_COLOR, ALL_SIDES, color, (float)TRUE]);
llSetLinkPrimitiveParamsFast(LINK_SET, [PRIM_COLOR,ALL_SIDES, <r2,g2,b2>,1.0]); // Same here
    }
}
}
}
}
</source>

Latest revision as of 17:42, 24 January 2015

Simple script to show how to set random primitive parameters. <source lang="lsl2"> default {

   state_entry()
   {
       // set timer to go off every other 5.0 seconds
       llSetTimerEvent(5.0);
   }
   timer()
   {
       vector color = <llFrand(1.0), llFrand(1.0), llFrand(1.0)>;
       // set random color on all sides of linkset with opaque as alpha value
       llSetLinkPrimitiveParamsFast(LINK_SET,
           [PRIM_COLOR, ALL_SIDES, color, (float)TRUE]);
   }

} </source>