Change the sun settings using OSSL

Creating scripts
Post Reply
User avatar
Oren Hurvitz
Posts: 291
Joined: Sun Dec 23, 2012 8:42 am
Has thanked: 8 times
Been thanked: 337 times

Change the sun settings using OSSL

Post by Oren Hurvitz » Wed Dec 26, 2012 12:15 pm

OSSL contains two functions that change the sun settings: osSetRegionSunSettings and osSetEstateSunSettings. Here's an example of how to use them:

Code: Select all

integer estateSunFixed;
float estateSunHour;

integer useEstateSun;
integer regionSunFixed;
float regionSunHour;

float DAWN = 0.0;
float NOON = 6.0;
float DUSK = 12.0;
float MIDNIGHT = 18.0;

default
{
    touch_start(integer total_number)
    {
        estateSunFixed = TRUE;
        estateSunHour = DAWN;
        osSetEstateSunSettings(estateSunFixed, estateSunHour);
        llSay(0 ,"osSetEstateSunSettings : sunFixed = " + estateSunFixed + ", sunHour = " + (string)estateSunHour);
        
        useEstateSun = FALSE;
        regionSunFixed = TRUE;
        regionSunHour = MIDNIGHT;
        osSetRegionSunSettings(useEstateSun, regionSunFixed, regionSunHour);
        llSay(0, "osSetRegionSunSettings : useEstateSun =  " + useEstateSun + ", sunFixed = " + regionSunFixed + ", sunHour = " + (string)regionSunHour);

        llSay(0, "Current sun hour: "+(string)osGetCurrentSunHour());
    }
}
These users thanked the author Oren Hurvitz for the post:
Constance Peregrine
User avatar
Adagio Greenwood
Posts: 128
Joined: Wed Jan 16, 2013 7:57 pm
Has thanked: 165 times
Been thanked: 102 times

Re: Change the sun settings using OSSL

Post by Adagio Greenwood » Sat Jan 26, 2013 6:14 pm

Is this something we would need to use if we use our region's environment settings?

Adagio
User avatar
Ilan Tochner
Posts: 4518
Joined: Sun Dec 23, 2012 8:44 am
Has thanked: 2171 times
Been thanked: 2380 times
Contact:

Re: Change the sun settings using OSSL

Post by Ilan Tochner » Sat Jan 26, 2013 7:12 pm

Hi Adagio,

No, it's only needed if you want to change those settings via a script. The viewer's region settings will work just as well.
User avatar
Adagio Greenwood
Posts: 128
Joined: Wed Jan 16, 2013 7:57 pm
Has thanked: 165 times
Been thanked: 102 times

Re: Change the sun settings using OSSL

Post by Adagio Greenwood » Sat Jan 26, 2013 7:31 pm

Thanks, Ilan, as always..............
User avatar
Ilan Tochner
Posts: 4518
Joined: Sun Dec 23, 2012 8:44 am
Has thanked: 2171 times
Been thanked: 2380 times
Contact:

Re: Change the sun settings using OSSL

Post by Ilan Tochner » Sat Jan 26, 2013 7:57 pm

You're welcome Adagio :-)
Post Reply