Jump to content

Problem: day and night can't be distinguished (automatic lights never work)


ChicByTrinity
 Share

You are about to reply to a thread that has been inactive for 4223 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

I need a script that turns light on (with fullbright and glow) when the sun goes down, and turns them off when the sun comes up again. I found 3 scripts, and none of them work whatsoever. :(

I'm using Firestorm, but I doubt that it's the case here.

Sun direction seems always the same, I can't do anything about it, I really need this to work...
None of the following worked for me. The first one shows some direction numbers, they never change!

http://wiki.secondlife.com/wiki/LlGetSunDirection

http://community.secondlife.com/t5/LSL-Library/Automatic-Light-Glow/td-p/1323573

http://inworldz.com/izwiki/index.php/Automatic_Day_Night_Light

 

I tried other scripts, this one always says "The Sun is coming!" no matter if it's daytime or midnight! Something is wrong.

http://wiki.secondlife.com/wiki/LlGetWallclock

Link to comment
Share on other sites

The sun direction is strictly a region thing. Some regions are set with a fixed day cycle instead of the default. The viewer's World / Sun settings don't change the region's cycle, which is what llGetSunDirection uses.

If the overall SL day/night cycle is broken, it would be a Very Big Deal.

Link to comment
Share on other sites

It's hard to know what you mean by "not working".  All three of the first scripts you gave links to work as advertized and they all do it the same way (and the only way that day/night scripts can work in SL).  They look periodically at the sun direction (llGetSunDirection) and check to see whether the height of the sun in the sky is positive (+Z = above the horizon) or negative (-Z = below the horizon).  That's how you tell in RL too.  The last script you gave a link to is different.  It will tell you whether it's daytime in the Pacific time zone in RL -- where Linden Lab is.  It won't tell you anything about what's happening in SL.

Day/Night in SL is never going to be perfect.  For one thing, we don't go instantly from light to dark.  It takes a while, just as it does in RL.  For another, the visual position of the sun in SL's sky is pretty arbitrary.  If you ever try tracking the sun to see where it is in the sky, you'll find that it's only roughly where you'd expect it to be according to the clock.  It's a cartoon sky.  The llGetSunDirection function gives a ballpark estimate of where the SL sun ought to be, but don't expect to be able to navigate by it.  It's fine for turning streetlights on and off, though.  Any one of those scripts will do it, so long as your sim has the moveable sun turned on.

Link to comment
Share on other sites

Try using Dora Gustafson's script, which should help you visualise what llGetSunDirection is actually doing.

As Rolig rightly notes, llGetSundDirection isn't particularly accurate -- in my experience, dawn breaks in SL quite some time before the sun appears on the horizon and it stays light some time after -- but it's a good enough guide, and the scripts you meantion should work with a bit of tweaking.

  • Like 1
Link to comment
Share on other sites

Thank you!

And, I may have found out what's been wrong. I probably misunderstood some things.

The last script shows the angle of the Sun, and it seems to be fixed on SL time/sun. I tried to force day/night, but it has no effect whatsoever. I chose different presets, played with the sun angle slider, but it has no effect...
So I'll always have to *wait* for day or night in order to see any changes? -.-

I wanted it to turn on/off even when I manually switch to day or night.

Link to comment
Share on other sites

I think you have identified the problem.  

As you surmise, llGetSunDirection returns the default SL sun direction.   It doesn't know anything about any presets or modifications you may have applied.   So you need to wait for what SL thinks should be the changes between day and night to see any changeds.

Link to comment
Share on other sites

Sure there is.  Just put them all on the same light switch.  Click the switch and it sends a llRegionSay message to all lights:  "Turn on!" or "Turn off!"  If you're not up to writing the script yourself, post your request in the InWorld Employment forum to get a scripter to write it for you.

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 4223 days.

Please take a moment to consider if this thread is worth bumping.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...