Loki Eliot Posted October 7, 2011 Share Posted October 7, 2011 Is anyone able to point me in any direction with regards to accoplising the following efect with a script.I have an object i want to appear during the day, then at night replaced with a different object by perhaps turning one object invisible and the other object not invisible?Can anyone advise on best practice to achieve this and point me in a direction for possible script examples please? Link to comment Share on other sites More sharing options...
Void Singer Posted October 7, 2011 Share Posted October 7, 2011 standard method is to check the llSunDirection on a timer... if the z value is less than than 0, and your "sun is up" variable is true, flip the variable. otherwise z is higher, and if your sun variable is false, flip it.... any time you flip it you can also take an action, like sending a command, rezzing a box etc. test = llGetSunDirection();if (test.z < 0.0){ if (isDay){ isDay = FALSE; //-- do night stuff }}else if (!isDay){ isDay = TRUE; //-- do day stuff} ETA:got sloppy, fixed 1 Link to comment Share on other sites More sharing options...
Arkady Arkright Posted October 7, 2011 Share Posted October 7, 2011 Here's a script which switches a light on at dusk, off at dawn. // Script to switch light on at dusk, off at dawninteger daytime (){ vector SunDirection; SunDirection = llGetSunDirection(); if (SunDirection.z>0.0) { return (FALSE); } else { return (TRUE); }}switchlight (integer onoff) // function to switch light on or off{ llSetPrimitiveParams([PRIM_FULLBRIGHT,ALL_SIDES,onoff]); llSetPrimitiveParams([PRIM_POINT_LIGHT,onoff,<1.0,1.0,1.0>,1.0,15.0,0.5]);}default { on_rez (integer start_param) { llResetScript(); } state_entry() { if (daytime()==TRUE) { state extinguished; } else { state illuminated; } } } state illuminated // switch light off at dawn{ state_entry() { switchlight(TRUE); llSetTimerEvent(300.0); } timer () { if (daytime()==TRUE) { llSetTimerEvent(0.0); state extinguished; } }}state extinguished // switch light on at dusk{ state_entry() { switchlight(FALSE); llSetTimerEvent(300.0); } timer () { if (daytime()==FALSE) { llSetTimerEvent(0.0); state illuminated; } }} 1 Link to comment Share on other sites More sharing options...
Loki Eliot Posted October 13, 2011 Author Share Posted October 13, 2011 Thank you so much Link to comment Share on other sites More sharing options...
Miles Macpherson Posted November 4, 2012 Share Posted November 4, 2012 I hate to necro an old thread, but I'm looking for assistance similar to what Loki needed. In my case, I want to have the face of a prim change textures depending on whether it's day or night. Thanks in advance. Link to comment Share on other sites More sharing options...
Rolig Loon Posted November 4, 2012 Share Posted November 4, 2012 Just take Void's post (above). Where it says "day stuff" or "night stuff", put your call to llSetTexture or llSetLinkPrimitiveParamsFast(Link_number, [PRIM_TEXTURE ...... 1 Link to comment Share on other sites More sharing options...
Miles Macpherson Posted November 4, 2012 Share Posted November 4, 2012 Thank you very much! Here is the LSL script I made. It's not exactly the one Void posted, but it seems to work. default { state_entry() { llSetTimerEvent(600); } timer() { vector sun = llGetSunDirection(); if(sun.z > 0) { llSetPrimitiveParams([PRIM_TEXTURE, ALL_SIDES, "paste UUID here"]); } else { llSetPrimitiveParams([PRIM_TEXTURE, ALL_SIDES, "paste UUID here"]); } }} Link to comment Share on other sites More sharing options...
Rolig Loon Posted November 4, 2012 Share Posted November 4, 2012 Bingo! Link to comment Share on other sites More sharing options...
Flapman Posted April 3, 2014 Share Posted April 3, 2014 Hello, I found this thread while loking for a script. I am looking to turn off the light fluction of my lights and light textures at night. This script does not seem to work in my objects. Can you help? A Link to comment Share on other sites More sharing options...
Rolig Loon Posted April 3, 2014 Share Posted April 3, 2014 If you are a scripter and are trying to find your way around a sticky spot in a script you are writing, you have come to the right place. That's what this forum is for. However, if you are looking for a free script (or even one to buy), there are several script libraries here, in the LSL wiki, and in world. You can also shop in Marketplace or do a Google search for script repositories elsewhere. If you are hoping to have someone write a script for you, you should post in the InWorld Employment forum. Link to comment Share on other sites More sharing options...
Recommended Posts
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