Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -------------------------------------------------
- -- Программа для контроллера с интернет платой --
- -- Бинарные часы для мода OpenComputers --
- -- проект http://computercraft.ru --
- -- 2017, © Asior --
- -------------------------------------------------
- int = component.proxy(component.list("internet")())
- mod = component.proxy(component.list("modem")())
- mod.open(1)
- while true do
- a=int.request("https://script.google.com/macros/s/AKfycbyd5AcbAnWi2Yn0xhFRbyzS4qMq1VucMVgVvhul5XqS9HkAyJY/exec")
- local s, vr, n, h, m = '', '',0 ,0 ,0
- repeat
- vr = vr..s
- s = tostring(a.read())
- until s == 'nil'
- a.close()
- _, n = string.find(vr, '"hours":')
- if n ~= nil then
- h = string.sub(vr, n+1, n+2)
- if not tonumber(h) then h = tonumber(string.sub(h, 1, 1)) end
- _, n = string.find(vr, '"minutes":')
- m = string.sub(vr, n+1, n+2)
- if not tonumber(m) then m = tonumber(string.sub(m, 1, 1)) end
- mod.broadcast(1, h, m)
- else
- mod.broadcast(1, 255, 255)
- end
- computer.pullSignal(10)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement