This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

Time dependent script
#10
You can add multiple elseif statements. Just make sure that hour checks are in an ascending order.
Code:
value = event.getvalue()

if value then
  hour = os.date('*t').hour

  -- 0:00 - 7:59
  if hour <= 7 then
    out = 10
  -- 8:00 - 16:59
  elseif hour <= 16 then
    out = 70
  -- 17:00 - 21:59
  elseif hour <= 21 then
    out = 30
  -- 22:00 - 23:59
  else
    out = 10
  end
else
  out = 0
end

grp.checkwrite('1/4/30', out)
Reply


Messages In This Thread
Time dependent script - by FatMax - 18.11.2015, 13:21
RE: Time dependent script - by admin - 19.11.2015, 07:23
RE: Time dependent script - by FatMax - 19.11.2015, 08:33
RE: Time dependent script - by FatMax - 14.01.2016, 13:18
RE: Time dependent script - by admin - 14.01.2016, 13:36
RE: Time dependent script - by FatMax - 14.01.2016, 13:39
RE: Time dependent script - by KoBra - 12.09.2023, 18:34
RE: Time dependent script - by admin - 13.09.2023, 07:44
RE: Time dependent script - by KoBra - 13.09.2023, 13:16
RE: Time dependent script - by admin - 13.09.2023, 14:16
RE: Time dependent script - by KoBra - 14.09.2023, 09:25

Forum Jump: