Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

script in root prim changing other prims' param

Lefty Belvedere
Lefty Belvedere
Join date: 11 Oct 2004
Posts: 276
04-03-2005 16:07
i'm using the following script for auto sensing daylight in outdoor lighting.

I need help altering this script so that it can effect a group of linked prims. I assume this would be easier on the client rather than having 8 identical scripts in all 8 prims...

i do not know how to setup a script to talk to other prims in a link.

thank you in advance,
Lefty

---------------------------------------------------------
// v0.0.4 - uses the new llSetPrimitiveParams() call to disable client light rendering when off!

float fTime = 0;
float fDayThresh = 0.66;
float fNightThresh = 3.46;
integer iTimerSecs = 300;
string sOutPre;

init()
{
sOutPre = llGetScriptName() + ": ";

refresh();
llSetTimerEvent(iTimerSecs);

llWhisper(0, sOutPre + (string)fTime + ": startup...";);
llWhisper(0, "Timer interval is: " + (string)iTimerSecs + " seconds.";);
}

refresh()
{
fTime = llGetTimeOfDay() / 3600.0;
}

set_light(integer iOn)
{
if (iOn == TRUE)
{
llSetPrimitiveParams( [PRIM_MATERIAL, PRIM_MATERIAL_LIGHT] );
}
else
{
llSetPrimitiveParams( [PRIM_MATERIAL, PRIM_MATERIAL_GLASS] );
}
}

integer IsDay(float fTimeOfDay)
{
integer iDay;

if ( fTimeOfDay > fDayThresh && fTimeOfDay < fNightThresh )
{
iDay = TRUE;
}
else
{
iDay = FALSE;
}

return iDay;
}

default
{
state_entry()
{
init();
if ( IsDay(fTime) )
{
state Day;
}
else
{
state Night;
}
}
}

state Day
{
state_entry()
{
refresh();
set_light( FALSE );
}

timer()
{
refresh();
if ( !IsDay(fTime) )
{
state Night;
}
}
}

state Night
{
state_entry()
{
refresh();
set_light( TRUE );
}

timer()
{
refresh();

if ( IsDay(fTime) )
{
state Day;
}
}
}
----------------------------------------------------------------
Jeffrey Gomez
Cubed™
Join date: 11 Jun 2004
Posts: 3,522
04-03-2005 16:18
Unfortunately, no llSetLinkMaterial exists. Your best bets are llSetLinkAlpha and llSetLinkColor, otherwise you're going to need a script in every prim. :o
_____________________
---