Logo Home   Documents and Lists   Create   Site Settings   Help   
Icon
Tolbers Computer Services - Tech Support and Computer Insight From Steven Tolbers
LSL Scripting Projects: Simple Touch-Light Script (On/Off)
   
New New Item
|
Edit Edit Item
|
Delete Delete Item
|
Alert Me
|
Go Back to List
Title:
Simple Touch-Light Script (On/Off)
Body:
// simple light source demonstrator
// 8feb07 "tetsumo kuri"
// thanks to squee janitor for line to dissect
 
integer light_s = TRUE;     //  "_s" for status
 
default
{
    state_entry()
    {
      //  llSetText("Light",<1,0,0.6>,.5);  // in case you like labels
    }
 
    touch_start(integer total_number)
    {
        if ( light_s )
        {
            light_s = FALSE;
 
            // fullbright doesn't have anything to do with light in NEW(2006?) lighting model
            // setting fullbright does look good though
            llSetPrimitiveParams([PRIM_FULLBRIGHT,ALL_SIDES,FALSE]);
 
            llSetPrimitiveParams([PRIM_POINT_LIGHT, FALSE,   // if this is false, light is off,
                                     <0.0,1.0,0.0>,1.0, 10.0, 0.5]); // rest of params don't matter
        }           
        else
        {
            light_s = TRUE;
            llSetPrimitiveParams([PRIM_FULLBRIGHT,ALL_SIDES,TRUE]);   //makes prim light up with FullBright            llSetPrimitiveParams([PRIM_POINT_LIGHT,TRUE,
                                    <1.0,0.7,1.0>,  // light color vector range: 0.0-1.0 *3
                                    1.0,            // intensity    (0.0-1.0)
                                    10.0,           // radius       (.1-10.0)
                                    0.6 ]);         // falloff      (.01-1.0)
 
            // this could have been done in one line, like this    
            //llSetPrimitiveParams([PRIM_FULLBRIGHT,ALL_SIDES,FALSE,PRIM_POINT_LIGHT,TRUE,<1.0,1.0,0.5>,20,1.0,0.5]);
            //      ... but thats kinda hard to take in...      
        }
        //llSay(0, " Click!");
    }
}
Expires:
Description:
Toggles natural light and "FullBright" texture change. Great for in-world lamps!
Attachments:
 
 
Created at 11/24/2008 5:21 PM by LakesideSteve
Last modified at 11/28/2008 2:07 PM by LakesideSteve