Hi MaximEpihin,
You are missing the [e] on "state" variables in the main function. it should be state[e]
Also try increasing that delay value to 1000 or so. 100 is 100millisecond = 1/10 second.
Cheers
-- LUA Script - precede every function and global member with lowercase name of script
local delay = 1000 -- 1000ms is 1 second
local start = 30
local state = {}
function daynight_init(e)
state[e] = "day"
StartTimer(e)
end
function daynight_main(e)
if GetTimer(e) < delay then
if state[e] == "day" then
if start > 0 then
start = start - 1
SetAmbienceIntensity(start)
else
state[e] = "night"
end
end
if state[e] == "night" then
if start < 30 then
start = start + 1
SetAmbienceIntensity(start)
else
state[e] = "day"
end
end
StartTimer(e)
end
end
Desktop: Intel(R) Core(TM) i7-4790 CPU @ 3.60GHz (8 CPUs), ~3.6GHz, Windows 8.1 64-bit, 16 GB Ram, NVIDIA GeForce GTX 750 Ti, Display Memory: 4018 MB. Resolution 1360x768, Passmark 3528.
Laptop: Pavilion dv6 Notebook, Intel(R) Core(TM) i5-2410M CPU @ 2.30 GHz, Win 7 64 bit, 16 GB Ram, Radeon (TM) HD 6490M, 2336 MB Memory. Resolution 1366x768, Intel(R) HD Graphics 3000. (WEI 5.8)