Advertisement
bacon_donut

Sub Monitor List

Feb 19th, 2015
746
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.96 KB | None | 0 0
  1. SleepTime = 30
  2.  
  3. if not fs.exists('json') then
  4.     write("JSON API not found - Downloading")
  5.     shell.run("pastebin get 4nRg9CHU json")
  6. end
  7.  
  8. os.loadAPI("json")
  9. local m = peripheral.wrap("top")
  10. m.setCursorPos(1,1)
  11.  
  12. while true do
  13.     str = http.get("https://URLToAJSONListOfRecentSubs").readAll()
  14.     obj = json.decode(str)
  15.     m.setBackgroundColor(colors.white)
  16.     m.setTextColor(colors.blue)
  17.     m.setTextScale(3)
  18.     m.clear()
  19.  
  20.     m.setCursorPos(1,1)
  21.     m.write("Bacon_Donut's Last Subs!")
  22.     m.setCursorPos(1,2)
  23.     m.write("Welcome to the Party!")
  24.     m.setCursorPos(1,3)
  25.     m.write("=====================")
  26.    
  27.     for i=1,6,1 do
  28.         m.setCursorPos(3,i+3)
  29.         m.write(obj[i])
  30.     end
  31.  
  32. --  m.setCursorPos(3,4)
  33. --  m.write(obj[1])
  34. --
  35. --  m.setCursorPos(3,5)
  36. --  m.write(obj[2])
  37. --
  38. --  m.setCursorPos(3,6)
  39. --  m.write(obj[3])
  40. --
  41. --  m.setCursorPos(3,7)
  42. --  m.write(obj[4])
  43. --
  44. --  m.setCursorPos(3,8)
  45. --  m.write(obj[5])
  46. --
  47. --  m.setCursorPos(3,9)
  48. --  m.write(obj[6])
  49. --
  50.     sleep(SleepTime)
  51. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement