Advertisement
davidweisgerber

Untitled

Feb 28th, 2015
193
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. function output(str)
  2. local i=1
  3. while i < string.len(str) do
  4. local char = string.sub(str,i,i)
  5. if char == '\n' then
  6. local x,y = monitor.getCursorPos()
  7. y = y + 1
  8. monitor.setCursorPos(1, y)
  9. elseif char == '#' then
  10. i = i + 1
  11. local color = tonumber(string.sub(str,i,i+4))
  12. monitor.setTextColor(color)
  13. i = i + 4
  14. else
  15. monitor.write(char)
  16. end
  17.  
  18. i = i + 1
  19. end
  20. end
  21.  
  22.  
  23. monitor = peripheral.wrap("back")
  24.  
  25. local request = http.get("https://fourconnected.homeip.net/cgi-bin/minecraft.cgi?action=monitor")
  26. monitor.clear()
  27. monitor.setCursorPos(1,1)
  28. output(request.readAll())
  29. request.close()
  30.  
  31. local time = os.time()
  32. local formattedTime = textutils.formatTime(time, false)
  33. write(formattedTime .. "Status updated")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement