Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Automatic Light Sorce

BabyAlice Tulip
Registered User
Join date: 18 Nov 2006
Posts: 19
05-04-2008 16:14
okie have no idea how to do what mes want so far scanings the form found one that lights up buts does not produce light. want its to produce lights automaticly whens sun go down and stop whens sun come up. any ideas???

CODE

default {
state_entry() {
llSetTimerEvent(60);
}
timer() {
vector sun = llGetSunDirection();
if(sun.z > 0) {
llSetPrimitiveParams([PRIM_MATERIAL,PRIM_MATERIAL_GLASS]);
}
else {
llSetPrimitiveParams([PRIM_MATERIAL,PRIM_MATERIAL_LIGHT]);
integer lightEffect = TRUE;
}
}
}
Johan Laurasia
Fully Rezzed
Join date: 31 Oct 2006
Posts: 1,394
05-04-2008 17:14
CODE

integer night=0;

default
{
state_entry()
{
llSetTimerEvent(300); // Check every 5 minutes
}

timer()
{
vector sun = llGetSunDirection();

if (sun.z <= 0) night = 1; // Sun is below the horizon
else
if (sun.z > 0) night = 0; // Sun is above the horizon

if (night == 1)
{
llSetPrimitiveParams ([PRIM_POINT_LIGHT, TRUE, <1, 1, 1>, 1.0, 10.0, 0.75 ] );
}
else
{
llSetPrimitiveParams ([PRIM_POINT_LIGHT, FALSE, <1,1,1>, 1.0, 10.0, 0.75] );
}
}
}
BabyAlice Tulip
Registered User
Join date: 18 Nov 2006
Posts: 19
05-04-2008 18:49
testings buts having to wait for sl nights
BabyAlice Tulip
Registered User
Join date: 18 Nov 2006
Posts: 19
05-04-2008 20:48
whats its the timer part is thats nessarys??? dose that cass it to shut on and off on its owns????
BabyAlice Tulip
Registered User
Join date: 18 Nov 2006
Posts: 19
05-04-2008 22:12
yay figure its out her the script

CODE

integer night=0;

default
{
state_entry()
{
llSetTimerEvent(60); // Check every 1 minutes
}

timer()
{
vector sun = llGetSunDirection();

if (sun.z <= 0) night = 1; // Sun is below the horizon
else
if (sun.z > 0) night = 0; // Sun is above the horizon

if (night == 1)
{
llSetPrimitiveParams([PRIM_FULLBRIGHT,ALL_SIDES,TRUE]);
llSetPrimitiveParams ([PRIM_POINT_LIGHT, TRUE, <1, 1, 1>, 1.0, 10.0, 0.75 ] );
}
else
{
llSetPrimitiveParams([PRIM_FULLBRIGHT,ALL_SIDES,FALSE]);
llSetPrimitiveParams ([PRIM_POINT_LIGHT, FALSE, <1,1,1>, 1.0, 10.0, 0.75] );
}
}
}