nate90909

Untitled

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