Difference between revisions of "RandomPrimParams"

From Second Life Wiki
Jump to navigation Jump to search
m
m (reduced timer speed a bit and changed comments for better readability)
Line 1: Line 1:
{{LSL Header}}{{LSLC|Examples}}
{{LSL Header}}{{LSLC|Examples}}
Simple script to show how to set random {{LSLGC|PrimitiveParams|primitive parameters}}.
Simple script to show how to set random {{LSLGC|PrimitiveParams|primitive parameters}}.
<lsl>default {
<lsl>
     state_entry() {
default
         llSetTimerEvent(0.2); // How fast repeat event
{
     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)>;//<r,g,b>
     timer()
         llSetLinkPrimitiveParamsFast(LINK_SET, [PRIM_COLOR, ALL_SIDES, color, 1.0]); // You can use any PrimParams here like for example PRIM_GLOW
    {
         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]);
     }
     }
}</lsl>
}
</lsl>

Revision as of 14:41, 7 October 2012

Simple script to show how to set random primitive parameters. <lsl> 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]);
   }

} </lsl>