Change the sun settings using OSSL

Creating scripts
Post Reply
User avatar
Oren Hurvitz
Posts: 360
Joined: Sun Dec 23, 2012 8:42 am
Has thanked: 18 times
Been thanked: 494 times
Contact:

Change the sun settings using OSSL

Post by Oren Hurvitz »

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 »

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

Adagio
User avatar
Ilan Tochner
Posts: 6204
Joined: Sun Dec 23, 2012 8:44 am
Has thanked: 4449 times
Been thanked: 4229 times
Contact:

Re: Change the sun settings using OSSL

Post by Ilan Tochner »

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 »

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

Re: Change the sun settings using OSSL

Post by Ilan Tochner »

You're welcome Adagio :-)
Post Reply