The integer constant PRIM_POINT_LIGHT has the value 23

PRIM_POINT_LIGHT is used to configure the point light configuration of the prim

Syntax

integer PRIM_POINT_LIGHT = 23;

Usage

[ PRIM_POINT_LIGHT, integer boolean, vector linear_color, float intensity, float radius, float falloff ]

integerbooleanTRUE enables, FALSE disables
vectorlinear_colorlinear color in RGB <R, G, B> (<0.0, 0.0, 0.0> = black, <1.0, 1.0, 1.0> = white)
floatintensityranges from 0.0 to 1.0
floatradiusranges from 0.1 to 20.0
floatfalloffranges from 0.01 to 2.0

When used with llSetPrimitiveParams & llSetLinkPrimitiveParams & llSetLinkPrimitiveParamsFast

llGetPrimitiveParams([ PRIM_POINT_LIGHT ]);

Returns the list [ integer boolean, vector linear_color, float intensity, float radius, float falloff ]

integerbooleanTRUE enables, FALSE disables
vectorlinear_colorlinear color in RGB <R, G, B> (<0.0, 0.0, 0.0> = black, <1.0, 1.0, 1.0> = white)
floatintensityranges from 0.0 to 1.0
floatradiusranges from 0.1 to 20.0
floatfalloffranges from 0.01 to 2.0

Caveats

Examples

Set the prim's color and the color of the light it emits to the same color:-

integer switch;

vector gLampCol = <255,190,121>; //Light colour in regular (0-255) sRGB space. This will be converted to LSL later.

default
{
    state_entry()
    {
        gLampCol /= 255; //Convert to LSL colour.
    }

    touch_start(integer total_number)
    {
        switch = !switch; //toggle the switch
        llSetLinkPrimitiveParamsFast(LINK_THIS,[
            PRIM_POINT_LIGHT,switch,llsRGB2Linear(gLampCol),1,20,0, //Convert colour to linear RGB as PRIM_POINT_LIGHT requires, using llsRGB2Linear
            PRIM_COLOR,ALL_SIDES,gLampCol,1,
            PRIM_GLOW,ALL_SIDES,switch,
            PRIM_FULLBRIGHT,ALL_SIDES,switch]);
    }
}

Basic light script:-

integer isLightTurnedOn;

default
{
    touch_start(integer total_number)
    {
//      toggle isLightTurnedOn between TRUE and FALSE
        isLightTurnedOn = !isLightTurnedOn;

        if (isLightTurnedOn)
        {
            llSetPrimitiveParams([
                PRIM_FULLBRIGHT, ALL_SIDES, FALSE,
                PRIM_POINT_LIGHT, FALSE, ZERO_VECTOR, 1.0, 10.0, 0.6]);
        }
        else
        {
            vector COLOR_ORANGE  = <1.000, 0.522, 0.106>;

            llSetPrimitiveParams([
                PRIM_FULLBRIGHT, ALL_SIDES, TRUE,
                PRIM_POINT_LIGHT, TRUE, COLOR_ORANGE, 1.0, 10.0, 0.6]);
        }
    }
}

A compact version of the above:-

integer switch;
default
{
    touch_start(integer total_number)
    {
        llSetPrimitiveParams(
        [       PRIM_FULLBRIGHT, ALL_SIDES, switch = !switch,
                PRIM_POINT_LIGHT, switch, <1, 0.5, 0.1> *  switch, 1, 10, 0.6 ] );      
    }
}

See also

Functions

Articles