Talk:LlGetSunDirection

From Second Life Wiki
Jump to: navigation, search

In the first example to "quickly determine whether it is day or night" you see the first line read as :

integer lightsOn = -1;//not TRUE or FALSE

I think its a very bad idea to label -1 as FALSE in capital in the comment, since FALSE is 0 in LSL and in most if not all programming languages

the comment should simply read "// assume lights off on start", this would be clear and wouldn't require any modification to the code

--Francoise Eichel 04:40, 14 May 2009 (UTC)

lightsOn isn't labeled as nor is it FALSE, it is labeled as being neither TRUE or FALSE. When the code runs, -1 won't match either the TRUE or FALSE value from the elevation test; which will result in it setting the fullbright attributes of the faces. Your proposed change of comment does not match how the code works. I think you are confused by the mix of Boolean keywords with integer types, LSL doesn't have a dedicated Boolean type and does not have Boolean compares, it uses integer compares instead (which is what the code exploits). -- Strife (talk|contribs) 10:30, 14 May 2009 (UTC)

Usefulnes

llGetSunDirection() is more or less useless for telling where you see the sun in world. If you are lucky it is correct once a cycle, at noon.
One reason for this is that the SIM day last three hours, but the night lasts only one.
Most importantly though, is that in Windlight the sun and the moon moves independently of the vector given by llGetSunDirection()
All is tested in the script at: sundirection and time of day
Dora Gustafson 03:53, 18 January 2013 (PST)