Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- line = true
- power = true
- location = "Europe/Oslo"
- for k,v in pairs(rs.getSides()) do
- if peripheral.getType(v) == "monitor" then
- mon = peripheral.wrap(v)
- break
- end
- end
- mon.setTextScale(4)
- function printTime()
- time = http.get("http://ts.svennp.com/time.php?location="..location).readAll()
- os.startTimer(0.95)
- mon.clear()
- mon.setCursorPos(1,1)
- if mon.isColor() then
- mon.setBackgroundColor(colors.green)
- end
- if #time == 4 then
- mon.write("0")
- end
- mon.write(time)
- mon.setCursorPos(3,1)
- if line then
- mon.write(":")
- else
- mon.write(" ")
- end
- line = not line
- end
- printTime()
- repeat
- e,p1 = os.pullEvent()
- if e == "timer" and power then
- printTime()
- elseif e == "redstone" or e == "monitor_touch" then
- if power then
- if mon.isColor() then
- mon.setBackgroundColor(colors.red)
- mon.setCursorPos(1,1)
- if #time == 4 then
- mon.write("0")
- end
- mon.write(time)
- end
- if e == "redstone" then
- os.pullEvent("redstone")
- end
- else
- printTime()
- end
- power = not power
- end
- until e == "char" and p1 == "q"
Add Comment
Please, Sign In to add comment