Re: Time based Lua script
Posted: Friday 30 January 2015 17:29
I'm guessing it's machine based but how many scripts is it possible to have running at any one time?
Code: Select all
time = os.date("*t")
commandArray = {}
if (timeofday['Daytime']) and (time.hour < 12) then
commandArray['Variable:Time-Variable']='Morning'
print("Time set to Morning")
elseif (timeofday['Daytime']) and (time.hour >= 12) then
commandArray['Variable:Time-Variable']='Afternoon'
print("Time set to Afternoon")
elseif (timeofday['Nighttime']) and (time.hour < 23) and (time.hour > 12) then
commandArray['Variable:Time-Variable']='Evening'
print("Time set to Evening")
elseif (timeofday['Nighttime']) then
commandArray['Variable:Time-Variable']='Night'
print("Time set to Night")
end
return commandArray
Code: Select all
if (timeofday['Daytime']) and (time.hour < 12) then
Code: Select all
if (timeofday['Daytime']) and (time.hour < 12) and uservariables["Time-Variable"] ~= "Morning" then