|
Dragger Lok
(loading ...)
Join date: 10 Sep 2006
Posts: 228
|
08-06-2007 11:25
Need to change textures on a prim day/night found this script posted I think in 2005.... can't get it to work, placed day texture and night texture keys in the script...waited and didnt change- the one thing I have not done was also place the textures in contents. Can someone point out where I'm going wrong? //day / night script by cua Curie //use it however ya like
key DayTexture="";//put the key of the day time texture here key NightTexture="";//putr the key of the night texture here integer side=1;//sets the side of the prim you want to change, use ALL_SIDES to change the entir prim
check() { vector sun_dir = llGetSunDirection();//gets the sun direction
if (sun_dir.z > 0 && llGetTexture(1)==NightTexture) //a positive value for sun_dir.z means its daytime { llSetTexture(DayTexture,1);//set the day texture }
else if (sun_dir.z < 0 && llGetTexture(1)==DayTexture) //a negative value for sun_dir.z means its nighttime { llSetTexture(NightTexture,1);
} llSetTimerEvent(120); }
default { state_entry() { check();//this calls the function to check the day / night status
}
timer() { check();//this calls the function to check the day / night status } }
|
|
Meade Paravane
Hedgehog
Join date: 21 Nov 2006
Posts: 4,845
|
08-06-2007 11:38
I'd probably do this instead. You're not going to see any changes until you set the textures, though... //day / night script by cua Curie, tweaked by the hedgehog //use it however ya like
integer IsDay; key DayTexture="";//put the key of the day time texture here key NightTexture="";//putr the key of the night texture here integer Side=1;//sets the side of the prim you want to change, use ALL_SIDES to change the entir prim
Check() { vector sun_dir = llGetSunDirection();//gets the sun direction
if (sun_dir.z > 0 && IsDay == FALSE) //a positive value for sun_dir.z means its daytime { IsDay = TRUE; llSetTexture(DayTexture, Side);//set the day texture } else if (sun_dir.z < 0 && IsDay == TRUE) //a negative value for sun_dir.z means its nighttime { IsDay = FALSE; llSetTexture(NightTexture, Side); } }
default { state_entry() { vector sun_dir = llGetSunDirection();
// set IsDay to the wrong value to force check() to update the texture IsDay = (sun_dir.z < 0); Check();
llSetTimerEvent(120); }
timer() { Check();//this calls the function to check the day / night status } }
_____________________
Tired of shouting clubs and lucky chairs? Vote for llParcelSay!!! - Go here: http://jira.secondlife.com/browse/SVC-1224- If you see "if you were logged in.." on the left, click it and log in - Click the "Vote for it" link on the left
|
|
Dragger Lok
(loading ...)
Join date: 10 Sep 2006
Posts: 228
|
Just Perfect!
08-06-2007 15:51
Worked like a charm! - many thanks-
|