Who Is Online

1
Online

Tuesday, 26 September 2017 06:24

Simple Prim Lighting

// Simple lighting (prim glow) script
//
// Lighting toggled on touch.
//
// For a version of this script that includes remote switching
// and multi-prim switching functionality, see:
// http://kimmscripts.wordpress.com/2011/11/23/simple-remote-lighting/
//
// Kimm Paulino
// January 2012
 
// Properties of the light you may wish to change
// ----------------------------------------------------
// LIGHT = TRUE or FALSE - turns the light on or off (lights contribute to lag in SL)
integer LIGHT = TRUE;
 
// BRIGHT = TRUE or FALSE - turns brightness on or off (less laggy than lights)
integer BRIGHT = TRUE;
 
// GLOW = Range 0.0 to 1.0 - dim to full glow
float GLOW = 1.0;
 
// See: http://lslwiki.net/lslwiki/wakka.php?wakka=color
vector COLOUR = <1.0, 1.0, 1.0>;
 
// Intensity of the radiated light - range 0.0 to 1.0
float INTENSITY = 1.0;    
 
// Radius of the radiated light (in metres) - range 0.1 to 20.0
float RADIUS = 5.0;
 
// Rate light decays - range 0.01 to 2.0 (no decay to quick decay)
float FALLOFF = 0.5;
 
// See: http://wiki.secondlife.com/wiki/Face
integer FACE = ALL_SIDES;
// ----------------------------------------------------
 
integer gOn = FALSE;
 
on ()
{
    // Turn on to the required settings
    llSetPrimitiveParams([
            PRIM_POINT_LIGHT, LIGHT, COLOUR, INTENSITY, RADIUS, FALLOFF,
            PRIM_FULLBRIGHT, FACE, BRIGHT,
            PRIM_GLOW, FACE, GLOW
            ]);
}
 
off ()
{
    llSetPrimitiveParams([
            PRIM_POINT_LIGHT, FALSE, ZERO_VECTOR, 0.0, 0.0, 0.0,
            PRIM_FULLBRIGHT, FACE, FALSE,
            PRIM_GLOW, FACE, FALSE
            ]);
}
 
performLightCmd ()
{
    if (gOn)
    {
        off();
        gOn = FALSE;
    }
    else
    {
        on();
        gOn = TRUE;
    }
}
 
default
{
    on_rez (integer start_param)
    {
        llResetScript();
    }
 
    state_entry ()
    {
        gOn = FALSE;
    }
 
    touch_start (integer num_detected)
    {
        performLightCmd();
    }
}

 

Flash Scratch to SL - Your Scripting Tool

Script ImageNeed to write a LSL script and don't know how to script?  I know I hate trying to get my head around LSLS when I an in a time crunch. So why not give Flash Scratch a try! Its a great tool for learning and scoding your own scripts for Second Life without having to pay someone to do it and without a crash course in LSL

A Huge thanks to John Bennet of ATLAS Institute at University of Colorado and Eric Rosenbaum at MIT for writing Scratch for SL to begin with.

Read more: Flash Scratch to SL - Your Scripting Tool