Lua script which sets the cvar.

Looking for a lua script which sets the Weather_v7 cvars.

Example(e2 chip):

@name Weather
@inputs Time
@outputs Reset
@persist Rain Sunny Storm Estorm
interval(1000)

Rain==random(1,100)
Sunny==random(1,10)
Storm==random(1,1000)
Estorm==random(1,10)

if(Rain==50) {concmd(“weather_select rain”)}
if(Sunny==50) {concmd(“weather_sunny”)}
if(Storm==50) {concmd(“weather_storm”)}
if(Estorm==50) {concmd(“weather_endstorm”)}

if(Time==240) {concmd(“weather_night”)}
if(Time==480) {concmd(“weather_day”)}
if(Time==481) {Reset==1}

Weather mod seems to use
[lua]SetGlobalString(“weather”,“name”)[/lua]
which allows storm, dark and sunny
You could use a timer to do this:
[lua]
local WeatherTypes = {“sunny”,“dark”,“storm”}
function ManageWeather( )
SetGlobalString(“weather”,table.Random(WeatherTypes))
end
timer.Create( “ManageWeather”, 10, 0, ManageWeather )[/lua]

Thanks, script work great!