Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local getDistance = require("getDistance")
- local monitor = peripheral.find("monitor")
- local main = term.current()
- local days = {}
- local function updating()
- term.redirect(monitor)
- term.clear()
- monitor.setTextScale(0.5)
- term.setCursorPos(1, 1)
- monitor.write("updating...")
- term.redirect(main)
- end
- local function update()
- local file = http.get("https://pastebin.com/raw/fgFNryB3#")
- local data = file.readAll()
- days = textutils.unserialize(data)
- table.insert(days, {name = "Glowsquid Server", cs = "opened", time = 1601726400})
- table.insert(days, {name = "Blended school \"will end\"", cu = "", time = 1604067300, removeIfAfter = true})
- file.close()
- end
- updating()
- update()
- local function draw()
- term.redirect(monitor)
- term.clear()
- monitor.setTextScale(0.5)
- term.setCursorPos(1, 0)
- for i, v in pairs(days) do
- if v.br then
- print("")
- else
- local str, way = getDistance(v.time)
- if way == 1 and v.removeIfAfter then else
- if way == 0 then
- local is = v.cu or "is"
- local nl = "\n"
- if is ~= "" then
- is = is .. " "
- end
- write("\n" .. v.name .. " " .. is .. "" .. str)
- elseif way == 1 then
- local is = v.cs or "was"
- if is ~= "" then
- is = is .. " "
- end
- write("\n" .. v.name .. " " .. is .. "" .. str)
- end
- end
- end
- end
- term.redirect(main)
- end
- while true do
- draw()
- sleep(10)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement