Difference between revisions of "User:Toady Nakamura/Two States Light"
Jump to navigation
Jump to search
m (Undo revision 1173604 by Kireji Haiku (Talk) Stop changing my user pages.) |
m (Undo revision 1173349 by Kireji Haiku (Talk) stop changing my user pages so they no longer match my class notes) |
||
Line 5: | Line 5: | ||
<lsl> | <lsl> | ||
default | vector color = <1,1,1>; // Use to change the color of the light | ||
{ | float intensity = 1.000; // Use to change the intensity of the light, from 0 up to 1 | ||
on_rez(integer | float radius = 10.000; // Use to change the Radius of the light, from 0 up to 20 | ||
float falloff = 0.750; // Use to set the falloff of the light, from 0 up to 2 | |||
default | |||
{ | |||
on_rez(integer param) | |||
{ | { | ||
llResetScript(); | llResetScript(); | ||
} | } | ||
touch_start(integer total_number) | |||
{ | |||
llSetPrimitiveParams([PRIM_POINT_LIGHT, TRUE, color, intensity, radius, falloff]); | |||
llSetPrimitiveParams([PRIM_FULLBRIGHT, ALL_SIDES, TRUE]); | |||
state unlit; | |||
} | |||
} | |||
touch_start(integer | state unlit | ||
{ | { | ||
touch_start(integer total_number) | |||
{ | |||
llSetPrimitiveParams([PRIM_POINT_LIGHT, FALSE, llSetPrimitiveParams([PRIM_POINT_LIGHT, FALSE, // when this is false, light is off, | |||
color, intensity, radius, falloff]); // rest of params don't matter | |||
state | llSetPrimitiveParams([PRIM_FULLBRIGHT, ALL_SIDES, FALSE]); | ||
} | state default; | ||
} | |||
} | |||
</lsl> | </lsl> |
Revision as of 09:17, 4 November 2012
Using two states can sometimes be an elegant solution to on/off.
- Original framework 04-16-08 by Toady Nakamura
- Light call modified from Simon Kline's classes "Scripting from Scratch"
<lsl>
vector color = <1,1,1>; // Use to change the color of the light float intensity = 1.000; // Use to change the intensity of the light, from 0 up to 1 float radius = 10.000; // Use to change the Radius of the light, from 0 up to 20 float falloff = 0.750; // Use to set the falloff of the light, from 0 up to 2
default {
on_rez(integer param) { llResetScript(); } touch_start(integer total_number) { llSetPrimitiveParams([PRIM_POINT_LIGHT, TRUE, color, intensity, radius, falloff]); llSetPrimitiveParams([PRIM_FULLBRIGHT, ALL_SIDES, TRUE]); state unlit; }
}
state unlit {
touch_start(integer total_number) { llSetPrimitiveParams([PRIM_POINT_LIGHT, FALSE, llSetPrimitiveParams([PRIM_POINT_LIGHT, FALSE, // when this is false, light is off, color, intensity, radius, falloff]); // rest of params don't matter llSetPrimitiveParams([PRIM_FULLBRIGHT, ALL_SIDES, FALSE]); state default; }
}
</lsl>