|
Dallas Prudhomme
Registered User
Join date: 24 Oct 2005
Posts: 30
|
10-07-2006 08:30
Hello. I would like to have lanterns appear on my land when it gets dark (realizing of course that some force the sun anyway), and have them "disappear" when it gets light in SL. I have used a cloaking script in the past to make things come and go and wonder if that could work, or if they could be temp on rez... or what?
Does anyone have a thought or solution for this? I dont know if there is a way to use the system clock or how that works. Help would be greatly appreciated. : )
Thanks, Dallas
|
|
Hugo Dalgleish
Registered User
Join date: 14 May 2006
Posts: 27
|
10-07-2006 08:45
You should be able to use the z component of the vector returned by llGetSunDirection() to see whether or not the sun is above or below the horizon.
One way to achive your goal is to use that in conjuction with either llSetAlpha() or llSetPrimitiveParams() and some linked messages to set all the prims in the object to be transparent when it's daytime, and return back to normal when it's night-time
|
|
Dallas Prudhomme
Registered User
Join date: 24 Oct 2005
Posts: 30
|
glug glug... over my head
10-07-2006 09:53
Hugo, thanks for the reply, and that all sounds wonderful... except I have no idea what you are talking about. hehe
I would certainly pay for a working script of this sort if someone was interested in bringing it to fruition.
Thanks!
|
|
Hugo Dalgleish
Registered User
Join date: 14 May 2006
Posts: 27
|
10-07-2006 11:17
I have something similar in my office - I have a light that turns on when someone gets near it and it's dark. The key bit is this: vector sun_location = llGetSunDirection();
// if sun location's z vector is less than or equal to zero // then the sun is at or below the horizon
if (sun_location.z <= 0) { // set objects in linked set to transparent & light off here }
I have similar ones in my store in Discordia but they're not quite as intelligent, they only turn on when someone walks up to them regardless of time of day
|
|
Ishtara Rothschild
Do not expose to sunlight
Join date: 21 Apr 2006
Posts: 569
|
10-07-2006 11:25
Here's a complete script: default { state_entry() { llSetPrimitiveParams([PRIM_MATERIAL,PRIM_MATERIAL_LIGHT]); // full brightness llSetTimerEvent(300); // Check sun position every 5 minutes } timer() { vector sun = llGetSunDirection(); if (sun.z > 0) // Sun is above the horizon { llSetAlpha(0,ALL_SIDES); // render the prim invisible llSetPrimitiveParams([PRIM_POINT_LIGHT, FALSE, <1, 1, 1>, 1.0, 10.0, 0.75]); // light off } else if (sun.z <= 0) // Sun is below the horizon { llSetAlpha(1,ALL_SIDES); // show the prim llSetPrimitiveParams([PRIM_POINT_LIGHT, TRUE, <1, 1, 1>, 1.0, 10.0, 0.75]); // light on } } } The script will turn the light on during the dusk and turn it off during dawn, so the light doesn't only show when it's completely dark. /Edit: if your lanterns consist of more than one prim, you'll need to put this script in the "lit" prim and perhaps modify it to send a linkset message in order to render the frame prims invisible too.
|
|
Dallas Prudhomme
Registered User
Join date: 24 Oct 2005
Posts: 30
|
Thank you...
10-07-2006 18:07
I appreciate all of the help!
|