This light cycle colour's the light, and backdrop with a different feel every day, cause in the real world not everyday is sunny and bright, so this code, though not perfect tires for a more realistic day/night cycle with, so if you want a red sky transitioning into full daylight one day and the next a hazy light green sky transitioning into mid afternoon then this code is for you. thank you.
rem sky light cycle globals
global amb#
global amb_step#
global redval#
global greenval#
global blueval#
global add_colour1
global add_colour2
global add_colour3
global day_start
randomize timer()
set point light 0, 0,0,0
set light range 0, 10000
do
rem control the speed of time
if sky_life + 100 < timer()
amb# = amb# + amb_step#
sky_life = timer()
endif
sky_light_cycle()
loop
function sky_light_cycle()
if amb# = 100 then amb_step# = -.5
if amb# = 0 then amb_step# = .5 : day_start = day_start + 1
if day_start = 2
add_colour1 = rnd(50)
add_colour2 = rnd(55)
add_colour3 = rnd(50)
day_start = 0
endif
if amb# < 20 then dark_colour = 2 else dark_colour = 0
redval# = amb# * 2 + add_colour1 - dark_colour
greenval# = amb# * 2 + add_colour3 - dark_colour
blueval# = amb# * 2 + add_colour2 - dark_colour
color light 0, rgb(redval#,greenval#,blueval#)
color ambient light rgb(redval#,greenval#,blueval#)
set ambient light amb#
set light range 0,amb#*100
color backdrop rgb(redval#,greenval#,blueval#)
endfunction