//Script by Deevyde Maelstrom of the Brainiacs
//Feel free to do whatever you want with it, but keep this header please :)

integer active;
float suntime;

default //Sets the object's material type to light when it's night time in world
{
    state_entry()
    {
        llSetTimerEvent(10);
    }

    timer()
    {
        suntime = llGetTimeOfDay() / 3600;
        if(suntime >= 3.5 | suntime <= 0.5 && active == 0)
        {
            llSetPrimitiveParams([PRIM_MATERIAL, PRIM_MATERIAL_LIGHT]);
            active = 1;
        }
        else if(suntime < 3.5 && suntime > 0.5 && active == 1)
        {
            llSetPrimitiveParams([PRIM_MATERIAL, PRIM_MATERIAL_GLASS]);
            active = 0;
        }
    }
}