nate90909

Untitled

Apr 30th, 2014
224
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.91 KB | None | 0 0
  1. os.loadAPI "monAPI"
  2. os.loadAPI "button"
  3.  
  4. local mon = monAPI.wrapMonitor("right")
  5. rednet.open("back")
  6.  
  7. function seccreate(sec,sx,sy,ex,ey,banknum,border,datasearch)
  8. sec = mon.createSection(sx,sy,ex,ey)
  9. sec.clear()
  10. if border == 1 then
  11. sec.setTextColor(colors.yellow)
  12. sec.drawBorder('#','#','+')
  13. end
  14.  
  15. if datasearch == 1 then
  16. sec.setTextColor(colors.white)
  17. sec.setCursorPos(2,3)
  18. sec.write('Turbine - Reactor Bank '..banknum..'')
  19. sec.setCursorPos(2,4)
  20. sec.write('Searching for Data Broadcast')
  21. end
  22. end
  23.  
  24. seccreate(section1,1,1,17,38,0,1,0)
  25. seccreate(section2,18,1,48,18,1,1,1)
  26. seccreate(section3,49,1,79,18,2,1,1)
  27. seccreate(section4,80,1,111,18,3,1,1)
  28. seccreate(section5,112,1,143,18,4,1,1)
  29. seccreate(section6,18,20,48,38,5,1,1)
  30. seccreate(section7,49,20,79,38,6,1,1)
  31. seccreate(section8,80,20,111,38,7,1,1)
  32. seccreate(section9,112,20,143,38,8,1,1)
  33.  
  34.  
  35. function turbinemon(idcode,bank,seec)
  36. id,message = rednet.receive()
  37.  
  38. if id == idcode then
  39. seec.clear()
  40. seec.setTextColor(colors.yellow)
  41. seec.drawBorder('#','#','+')
  42. seec.setCursorPos(2,3)
  43. seec.setTextColor(colors.white)
  44. seec.write('Turbine - Reactor Bank '..bank..'')
  45. seec.setCursorPos(2,4)
  46. seec.write('Data Broadcast Received')
  47. seec.setCursorPos(2,5)
  48. seec.write('System Status')
  49. seec.setCursorPos(2,7)
  50. seec.write('Turbine:')
  51. seec.setCursorPos(2,8)
  52. if message["turbine1rpm"] >= 1725 then
  53. seec.setTextColor(colors.green)
  54. elseif message["turbine1rpm"] >= 800 then
  55. seec.setTextColor(colors.orange)
  56. else
  57. seec.setTextColor(colors.red)
  58. end
  59. seec.write('RPM: '..message["turbine1rpm"]..'')
  60. seec.setCursorPos(2,9)
  61. if message["turbine1Flow"] >= 1950 then
  62. seec.setTextColor(colors.green)
  63. elseif message["turbine1Flow"] >= 1000 then
  64. seec.setTextColor(colors.orange)
  65. else
  66. seec.setTextColor(colors.red)
  67. end
  68. seec.write('Flow Rate: '..message["turbine1Flow"]..'mb/t')
  69. seec.setCursorPos(2,10)
  70. if message["turbine1RFT"] >= 25000 then
  71. seec.setTextColor(colors.green)
  72. elseif message["turbine1RFT"] >= 14000 then
  73. seec.setTextColor(colors.orange)
  74. else
  75. seec.setTextColor(colors.red)
  76. end
  77. seec.write('Generation: '..message["turbine1RFT"]..' rf/t')
  78. seec.setCursorPos(2,11)
  79. if message["turbine1capacitor"] >= 900000 then
  80. seec.setTextColor(colors.green)
  81. elseif message["turbine1capacitor"] >= 400000 then
  82. seec.setTextColor(colors.orange)
  83. else
  84. seec.setTextColor(colors.red)
  85. end
  86. seec.write('Capacitor: '..message["turbine1capacitor"]..'')
  87. seec.setCursorPos(2,13)
  88. seec.setTextColor(colors.white)
  89. seec.write('Reactor:')
  90. seec.setCursorPos(2,14)
  91. if message["reactor1Temp"] <= 700 then
  92. seec.setTextColor(colors.green)
  93. elseif message["reactor1Temp"] <= 800 then
  94. seec.setTextColor(colors.orange)
  95. else
  96. seec.setTextColor(colors.red)
  97. end
  98. seec.write('Temp: '..message["reactor1Temp"]..'')
  99. seec.setCursorPos(2,15)
  100. if message["reactor1Steam"] >= 1950 then
  101. seec.setTextColor(colors.green)
  102. elseif message["reactor1Steam"] >= 1000 then
  103. seec.setTextColor(colors.orange)
  104. else
  105. seec.setTextColor(colors.red)
  106. end
  107. seec.write('Steam Pressure: '..message["reactor1Steam"]..'')
  108. seec.setCursorPos(2,16)
  109. if message["reactor1Fuel"] <= 0.05 then
  110. seec.setTextColor(colors.green)
  111. elseif message["reactor1Fuel"] <= 0.08 then
  112. seec.setTextColor(colors.orange)
  113. else
  114. seec.setTextColor(colors.red)
  115. end
  116. seec.write('Fuel Consumption: '..message["reactor1Fuel"]..'')
  117.  
  118. end
  119.  
  120. while true do
  121. sleep(0)
  122. turbinemon(3,1,section2)
  123. turbinemon(2,2,section3)
  124. turbinemon(4,3,section4)
  125. turbinemon(5,4,section5)
  126. turbinemon(6,5,section6)
  127. turbinemon(7,6,section7)
  128. turbinemon(8,7,section8)
  129. turbinemon(9,8,section9)
  130. end
Advertisement
Add Comment
Please, Sign In to add comment