_rand=0
_factor=1
_wait=0
_step=1
_firstTime=true
_letters=["Oc","R","F"]

_OctimeRange=120
_OctimeModifier=480
_OclevRange=0.4
;_OclevModifier=0.2

_RtimeRange=120
_RtimeModifier=480
_RlevRange=0.4
;_RlevModifier=0.2

_FtimeRange=120
_FtimeModifier=480
_FlevRange=0.4
;_FlevModifier=0.2

_cnt=0
_count=1

ocl0=0.5; rl0=0.5; fl0=0.5

#Random
_t=0; "Format [""_rand=random _%1timeRange; %1t%2=_rand-(_rand mod 1)+_%1timeModifier; publicVariable {%1t%2}"",_letters select _t,_step] forEach [0]; _t=_t+1" forEach [1,2,3]
;_t=0; "Format [""_rand=random _%1levRange; %1l%2=_rand+_%1levModifier; publicVariable {%1l%2}"",_letters select _t,_step] forEach [0]; _t=_t+1" forEach [1,2,3]


_t=0; "Format [""if (random 1>0.5) then {_factor=1} else {_factor=-1}; %1l%2=%1l%3+(random _%1levRange)*_factor; if (%1l%2<0) then {%1l%2=0}; if (%1l%2>1) then {%1l%2=1}; publicVariable {%1l%2}"",_letters select _t,_step,_step-1] forEach [0]; _t=_t+1" forEach [1,2,3]


? !_firstTime : _step=_step+1
? !_firstTime && _step==4 : _step=1; ocl0=ocl3; rl0=ocl3; fl0=ocl3

? _firstTime && _step<3 : _step=_step+1; goto "Random"
? _firstTime : _step=1; _firstTime=false


#Wait
;player globalchat format ["ocl0:%1 ocl1:%2 ocl2:%3 ocl3:%4",ocl0,ocl1,ocl2,ocl3]
_a1=(call ("Ocl"+format ["%1",_step]))
_a2=(call ("Oct"+format ["%1",_step]))

_b1=(call ("Rl"+format ["%1",_step]))
_b2=(call ("Rt"+format ["%1",_step]))

_c1=(call ("Fl"+format ["%1",_step]))
_c2=(call ("Ft"+format ["%1",_step]))

;hint format ["_step:%7\n\nOvercast:%1\nTime:%2\n\nRain:%3\nTime:%4\n\nFog:%5\nTime:%6",_a1,_a2,_b1,_b2,_c1,_c2,_step]

Format ["if (rt%1>ft%1) then {_wait=rt%1} else {_wait=ft%1}",_step] forEach [0]
~(call ("Oct"+format ["%1",_step]))+_wait
goto "Random"
