Difference between revisions of "RandomPrimParams"

From Second Life Wiki
Jump to navigation Jump to search
(cleanup)
Line 1: Line 1:
<lsl> integer int=3;
{{LSL Header}}{{LSLC|Examples}}
Simple script to show how to set random {{LSLGC|PrimParams|primitive parameters}}.
default {
<lsl>default {
state_entry() {
    state_entry() {
llSetTimerEvent(0.1); // How fast repeat event
        llSetTimerEvent(0.2); // How fast repeat event
}
    }
timer() {
    timer() {
    float r = llFrand(1);
        vector color = <llFrand(1.0), llFrand(1.0), llFrand(1.0)>;//<r,g,b>
    float g = llFrand(1);
        llSetLinkPrimitiveParamsFast(LINK_SET, [PRIM_COLOR, ALL_SIDES, color, 1.0]); // You can use any PrimParams here like for example PRIM_GLOW
    float b = llFrand(1);
    }
    float r2 = llFrand(1);
}</lsl>
    float g2 = llFrand(1);
    float b2 = llFrand(1);
if(int==1)
++int;
llSetLinkPrimitiveParamsFast(LINK_SET, [PRIM_COLOR,ALL_SIDES, <r,g,b>, 1.0]); // You can use every PrimParams here like for example PRIM_GLOW
} else {
int=1;
llSetLinkPrimitiveParamsFast(LINK_SET, [PRIM_COLOR,ALL_SIDES, <r2,g2,b2>,1.0]); // Same here
}
}
}
</lsl>

Revision as of 20:59, 29 April 2012

Simple script to show how to set random primitive parameters. <lsl>default {

   state_entry() {
       llSetTimerEvent(0.2); // How fast repeat event
   }
   timer() {
       vector color = <llFrand(1.0), llFrand(1.0), llFrand(1.0)>;//<r,g,b>
       llSetLinkPrimitiveParamsFast(LINK_SET, [PRIM_COLOR, ALL_SIDES, color, 1.0]); // You can use any PrimParams here like for example PRIM_GLOW
   }

}</lsl>