Advertisement
adolf01

Untitled

Jan 9th, 2014
302
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2.  
  3.  
  4.  
  5. local mon = peripheral.wrap("top")
  6. local b = peripheral.wrap(boiler)
  7.  
  8. mon.clear()
  9. --Adjust the textscale if you have a bigger/smaller monitor
  10. --Increments of 0.5
  11. mon.setTextScale(1)
  12. mon.setTextColor(512)
  13. mon.setCursorPos(1,1)
  14. mon.write("Boiler status:")
  15.  
  16. while true do
  17.  
  18. tank = b.getTanks("top")
  19.  
  20.  
  21.  
  22.  
  23. local i = 3
  24.  
  25. for k,v in pairs(tank)do
  26.  
  27. mon.setCursorPos(1,i)
  28. mon.clearLine()
  29. mon.setTextColor(512)
  30.  
  31. if v["name"] ~=nil then
  32. mon.write(v["name"] .. ": ")
  33. end
  34.  
  35. mon.setTextColor(colors.orange)
  36. if v["amount"] ~=nil and v["capacity"] ~=nil then
  37. mon.setCursorPos(9,i)
  38. tmp = (v["amount"] / v["capacity"]) *100
  39. tmp = string.match(tostring(tmp),"[^%.]+")
  40. mon.write(tmp .. "%")
  41. end
  42. i = i +1
  43. end
  44.  
  45.  
  46. mon.setCursorPos(1,i)
  47. mon.clearLine()
  48. mon.setTextColor(512)
  49. temp = string.match(tostring(b.getTemperature()),"[^%.]+")
  50. mon.write("Temp: ")
  51. mon.setTextColor(colors.orange)
  52. mon.write( temp .."'C")
  53. os.sleep(1)
  54. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement