Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

llGetSunDirection

Zena Juran
Registered User
Join date: 21 Jul 2007
Posts: 473
05-22-2008 06:10
Hiyas everyone,

I have a simple "nightlight" script that doesn't seem to go TRUE. It will go FALSE. I'm on a private island. I checked the wiki... llGetSunDirection seems to be still in use. Any ideas why this won't go TRUE? I place the script in a sphere 0.1x0.1x0.1m. There no other light sources nearby. All help greatly appreciated. :-)

CODE

default
{
state_entry()
{
llSetTimerEvent(60);
}

timer()
{
vector sun = llGetSunDirection();
if (sun.z <= 0)
{
llSetPrimitiveParams([ PRIM_POINT_LIGHT,
TRUE,
<1, 1, 1>,
0.5,
1.00,
0.75]);}
else if (sun.z > 0)
{
llSetPrimitiveParams([ PRIM_POINT_LIGHT,
FALSE,
<1, 1, 1>,
0.5,
1.00,
0.75]);}


}
}
CODE
Debbie Trilling
Our Lady of Peenemünde
Join date: 17 Oct 2006
Posts: 434
05-22-2008 06:35
In the 'Region/Estate' settings under the 'Estate' tab, is the 'Use Global Time' or the 'Fixed Sun' option set?

'Fixed Sun' = "sets the sun position...and stops the sun from moving"

Not sure if this is the problem or not, but worth a quick look.
_____________________
http://wiki.secondlife.com/wiki/User:debbie_Trilling
Beezle Warburton
=o.O=
Join date: 10 Nov 2006
Posts: 1,169
05-22-2008 06:45
Check to make sure you have local lights enabled in your graphics options?

Also keep in mind that the timer event won't run immediately, but only after the initial 60s.

Minor nitpick, but probably not causing the problem:

else if (sun.z > 0)

can be just plain

else
_____________________
Though this be madness, yet there is method in't.
-- William Shakespeare

Warburton's Whimsies:
In SL
Apez.biz
Dora Gustafson
Registered User
Join date: 13 Mar 2007
Posts: 779
05-22-2008 06:47
Could you test the script on the mainland? interesting to know if the same thing happens
_____________________
From Studio Dora
Zena Juran
Registered User
Join date: 21 Jul 2007
Posts: 473
05-22-2008 07:23
Thanks for the replies. I do have local lights enabled (I can manually set the prim to lights on and it works) and the Estates setting is set for Global. I'll try it on the mainland in justa few. :-)
Wordfromthe Wise
Cheerless & Sorrowful
Join date: 31 Jan 2007
Posts: 18
Estate/Region Time vs. Viewer forced Time
05-29-2008 05:26
.. you know that llGetSunDirection only works on the "real" SunDirection ?
I mean you can force Midnight in your Viewer but if the Sim you are in is not
really in Night/Midnight Mode your script knows that and doesn`t fire ..

i can only 'really' test my Day/Night Scripts every 6 Hours .. so for Germany
and a in RL working Resident that is around 19:00 PM and 01:00 AM .. therefore
i made a script to get the SL time and do a if else

if ( hours >= 08 && hours <= 11 && tod == "pm" ) llRegionSay(123,"switch_on";);
if ( hours >= 00 && hours <= 04 && tod == "am" ) llRegionSay(123,"switch_on";);

and my Day/Night Objects listening on the 123 and start or stop ...

somethinglike this.. but important is your scripts check the real SunDirection of the
Sim it is in and and not the Viewer forced one ..


hope that helps
best regards
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
05-29-2008 07:44
From: Wordfromthe Wise
i can only 'really' test my Day/Night Scripts every 6 Hours...


I think you might be able to test it more often if you have--or a friend has--estate powers. I believe you could keep pushing the time back to just before sunrise/sunset (NOT global time), but not freeze it at the fixed time.
Wordfromthe Wise
Cheerless & Sorrowful
Join date: 31 Jan 2007
Posts: 18
05-29-2008 09:56
From: Hewee Zetkin
I think you might be able to test it more often if you have--or a friend has--estate powers. I believe you could keep pushing the time back to just before sunrise/sunset (NOT global time), but not freeze it at the fixed time.


neither me nor a friend has this power ;-) but it is ok ...
the if else with the hours is also good ..

tyvw