vvenaya

Untitled

Sep 14th, 2013
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.02 KB | None | 0 0
  1. local mon=peripheral.wrap("monitor_1")
  2. local ae=peripheral.wrap("appeng_me_tilecontroller_0")
  3.  
  4. local mon_h,mon_v=mon.getSize()
  5.  
  6. local timer=os.startTimer(5)
  7.  
  8. local function setupScreen()
  9. mon.clear()
  10. mon.setCursorPos(1,mon_v)
  11. mon.setBackgroundColor(colours.white)
  12. mon.setTextColor(colours.black)
  13. mon.write(string.rep(" ",mon_h))
  14. mon.setCursorPos(2,mon_v)
  15. mon.write("AE")
  16. end
  17.  
  18. local function updateMonitorAE()
  19.  
  20. local free=ae.getFreeBytes()
  21. local total=ae.getTotalBytes()
  22.  
  23. mon.setCursorPos(5,mon_v)
  24. mon.setBackgroundColor(colours.white)
  25.  
  26. if free>(total/2) then
  27. mon.setTextColor(colours.black)
  28. elseif free<1000 then
  29. mon.setTextColor(colours.red)
  30. else
  31. mon.setTextColor(colours.yellow)
  32. end
  33.  
  34. mon.write(ae.getFreeBytes())
  35. mon.write("/"..ae.getTotalBytes().." ")
  36. sleep(5)
  37. end
  38.  
  39. setupScreen()
  40. updateMonitorAE()
  41.  
  42. while true do
  43. local e,p = os.pullEvent()
  44. if e=="timer" and p==timer then
  45. updateMonitorAE()
  46. end
  47. end
Advertisement
Add Comment
Please, Sign In to add comment