SHOW:
|
|
- or go back to the newest paste.
| 1 | os.loadAPI "monAPI" | |
| 2 | local turbine1 | |
| 3 | local reactor1 | |
| 4 | local mon = monAPI.wrapMonitor("right")
| |
| 5 | ||
| 6 | --initialize monitor | |
| 7 | ||
| 8 | mon.setTextColor(colors.white) | |
| 9 | mon.setBackgroundColor(colors.black) | |
| 10 | mon.clear() | |
| 11 | mon.setCursorPos(1,1) | |
| 12 | - | local section1 = mon.createSection(1,1,20,18) |
| 12 | + | |
| 13 | ||
| 14 | - | local section2 = mon.createSection(21,1,51,18) |
| 14 | + | --initialize sections |
| 15 | ||
| 16 | - | local section3 = mon.createSection(52,1,82,18) |
| 16 | + | local section1 = mon.createSection(1,1,17,38) --button area |
| 17 | section1.clear() | |
| 18 | - | local section4 = mon.createSection(83,1,114,18) |
| 18 | + | section1.setTextColor(colors.yellow) |
| 19 | section1.drawBorder('#','#','+')
| |
| 20 | ||
| 21 | local section2 = mon.createSection(18,1,48,18) --banks | |
| 22 | section2.clear() | |
| 23 | section2.setTextColor(colors.yellow) | |
| 24 | section2.drawBorder('#','#','+')
| |
| 25 | section2.setTextColor(colors.white) | |
| 26 | section2.setCursorPos(2,3) | |
| 27 | section2.write('Turbine - Reactor Bank 1')
| |
| 28 | section2.setCursorPos(2,4) | |
| 29 | section2.write('Searching for Data Broadcast')
| |
| 30 | ||
| 31 | local section3 = mon.createSection(49,1,79,18) | |
| 32 | section3.clear() | |
| 33 | section3.setTextColor(colors.yellow) | |
| 34 | section3.drawBorder('#','#','+')
| |
| 35 | section3.setTextColor(colors.white) | |
| 36 | section3.setCursorPos(2,3) | |
| 37 | section3.write('Turbine - Reactor Bank 2')
| |
| 38 | section3.setCursorPos(2,4) | |
| 39 | section3.write('Searching for Data Broadcast')
| |
| 40 | ||
| 41 | local section4 = mon.createSection(80,1,111,18) | |
| 42 | section4.clear() | |
| 43 | section4.setTextColor(colors.yellow) | |
| 44 | section4.drawBorder('#','#','+')
| |
| 45 | section4.setTextColor(colors.white) | |
| 46 | section4.setCursorPos(2,3) | |
| 47 | section4.write('Turbine - Reactor Bank 3')
| |
| 48 | section4.setCursorPos(2,4) | |
| 49 | section4.write('Searching for Data Broadcast')
| |
| 50 | ||
| 51 | local section5 = mon.createSection(112,1,142,18) | |
| 52 | section5.clear() | |
| 53 | section5.setTextColor(colors.yellow) | |
| 54 | section5.drawBorder('#','#','+')
| |
| 55 | section5.setTextColor(colors.white) | |
| 56 | section5.setCursorPos(2,3) | |
| 57 | section5.write('Turbine - Reactor Bank 4')
| |
| 58 | section5.setCursorPos(2,4) | |
| 59 | section5.write('Searching for Data Broadcast')
| |
| 60 | ||
| 61 | local section6 = mon.createSection(18,20,48,38) | |
| 62 | section6.clear() | |
| 63 | section6.setTextColor(colors.yellow) | |
| 64 | section6.drawBorder('#','#','+')
| |
| 65 | section6.setTextColor(colors.white) | |
| 66 | section6.setCursorPos(2,3) | |
| 67 | section6.write('Turbine - Reactor Bank 5')
| |
| 68 | section6.setCursorPos(2,4) | |
| 69 | section6.write('Searching for Data Broadcast')
| |
| 70 | ||
| 71 | local section7 = mon.createSection(49,20,79,38) | |
| 72 | section7.clear() | |
| 73 | section7.setTextColor(colors.yellow) | |
| 74 | section7.drawBorder('#','#','+')
| |
| 75 | section7.setTextColor(colors.white) | |
| 76 | section7.setCursorPos(2,3) | |
| 77 | section7.write('Turbine - Reactor Bank 6')
| |
| 78 | section7.setCursorPos(2,4) | |
| 79 | section7.write('Searching for Data Broadcast')
| |
| 80 | ||
| 81 | local section8 = mon.createSection(80,20,111,38) | |
| 82 | section8.clear() | |
| 83 | section8.setTextColor(colors.yellow) | |
| 84 | section8.drawBorder('#','#','+')
| |
| 85 | section8.setTextColor(colors.white) | |
| 86 | section8.setCursorPos(2,3) | |
| 87 | section8.write('Turbine - Reactor Bank 7')
| |
| 88 | section8.setCursorPos(2,4) | |
| 89 | section8.write('Searching for Data Broadcast')
| |
| 90 | ||
| 91 | local section9 = mon.createSection(112,20,143,38) | |
| 92 | section9.clear() | |
| 93 | section9.setTextColor(colors.yellow) | |
| 94 | section9.drawBorder('#','#','+')
| |
| 95 | section9.setTextColor(colors.white) | |
| 96 | section9.setCursorPos(2,3) | |
| 97 | section9.write('Turbine - Reactor Bank 8')
| |
| 98 | section9.setCursorPos(2,4) | |
| 99 | section9.write('Searching for Data Broadcast')
| |
| 100 | ||
| 101 | --start program | |
| 102 | ||
| 103 | while true do | |
| 104 | rednet.open("back")
| |
| 105 | id,message = rednet.receive() | |
| 106 | ||
| 107 | if id == 158 then | |
| 108 | section2.clear() | |
| 109 | section2.setTextColor(colors.yellow) | |
| 110 | section2.drawBorder('#','#','+')
| |
| 111 | section2.setCursorPos(2,3) | |
| 112 | section2.setTextColor(colors.white) | |
| 113 | section2.write('Turbine - Reactor Bank 1')
| |
| 114 | section2.setCursorPos(2,4) | |
| 115 | section2.write('Data Broadcast Received')
| |
| 116 | section2.setCursorPos(2,5) | |
| 117 | section2.write('System Status')
| |
| 118 | section2.setCursorPos(2,7) | |
| 119 | section2.write('Turbine:')
| |
| 120 | section2.setCursorPos(2,8) | |
| 121 | if message["turbine1rpm"] >= 1725 then | |
| 122 | section2.setTextColor(colors.green) | |
| 123 | elseif message["turbine1rpm"] >= 800 then | |
| 124 | section2.setTextColor(colors.orange) | |
| 125 | else | |
| 126 | section2.setTextColor(colors.red) | |
| 127 | end | |
| 128 | section2.write('RPM: '..message["turbine1rpm"]..'')
| |
| 129 | section2.setCursorPos(2,9) | |
| 130 | if message["turbine1Flow"] >= 1950 then | |
| 131 | section2.setTextColor(colors.green) | |
| 132 | elseif message["turbine1Flow"] >= 1000 then | |
| 133 | section2.setTextColor(colors.orange) | |
| 134 | else | |
| 135 | section2.setTextColor(colors.red) | |
| 136 | end | |
| 137 | section2.write('Flow Rate: '..message["turbine1Flow"]..'mb/t')
| |
| 138 | section2.setCursorPos(2,10) | |
| 139 | if message["turbine1RFT"] >= 25000 then | |
| 140 | section2.setTextColor(colors.green) | |
| 141 | elseif message["turbine1RFT"] >= 14000 then | |
| 142 | section2.setTextColor(colors.orange) | |
| 143 | else | |
| 144 | section2.setTextColor(colors.red) | |
| 145 | end | |
| 146 | section2.write('Generation: '..message["turbine1RFT"]..' rf/t')
| |
| 147 | section2.setCursorPos(2,11) | |
| 148 | if message["turbine1capacitor"] >= 900000 then | |
| 149 | section2.setTextColor(colors.green) | |
| 150 | elseif message["turbine1capacitor"] >= 400000 then | |
| 151 | section2.setTextColor(colors.orange) | |
| 152 | else | |
| 153 | section2.setTextColor(colors.red) | |
| 154 | end | |
| 155 | section2.write('Capacitor: '..message["turbine1capacitor"]..'')
| |
| 156 | section2.setCursorPos(2,13) | |
| 157 | section2.setTextColor(colors.white) | |
| 158 | section2.write('Reactor:')
| |
| 159 | section2.setCursorPos(2,14) | |
| 160 | if message["reactor1Temp"] <= 700 then | |
| 161 | section2.setTextColor(colors.green) | |
| 162 | elseif message["reactor1Temp"] <= 800 then | |
| 163 | section2.setTextColor(colors.orange) | |
| 164 | else | |
| 165 | section2.setTextColor(colors.red) | |
| 166 | end | |
| 167 | section2.write('Temp: '..message["reactor1Temp"]..'')
| |
| 168 | section2.setCursorPos(2,15) | |
| 169 | if message["reactor1Steam"] >= 1950 then | |
| 170 | section2.setTextColor(colors.green) | |
| 171 | elseif message["reactor1Steam"] >= 1000 then | |
| 172 | section2.setTextColor(colors.orange) | |
| 173 | else | |
| 174 | section2.setTextColor(colors.red) | |
| 175 | end | |
| 176 | section2.write('Steam Pressure: '..message["reactor1Steam"]..'')
| |
| 177 | section2.setCursorPos(2,16) | |
| 178 | if message["reactor1Fuel"] <= 0.06 then | |
| 179 | section2.setTextColor(colors.green) | |
| 180 | elseif message["reactor1Fuel"] <= 0.05 then | |
| 181 | section2.setTextColor(colors.orange) | |
| 182 | else | |
| 183 | section2.setTextColor(colors.red) | |
| 184 | end | |
| 185 | section2.write('Fuel Consumption: '..message["reactor1Fuel"]..'')
| |
| 186 | ||
| 187 | elseif id == 159 then | |
| 188 | section3.clear() | |
| 189 | section3.setTextColor(colors.yellow) | |
| 190 | section3.drawBorder('#','#','+')
| |
| 191 | section3.setCursorPos(2,3) | |
| 192 | section3.setTextColor(colors.white) | |
| 193 | section3.write('Turbine - Reactor Bank 2')
| |
| 194 | section3.setCursorPos(2,4) | |
| 195 | section3.write('Data Broadcast Received')
| |
| 196 | section3.setCursorPos(2,5) | |
| 197 | section3.write('System Status')
| |
| 198 | section3.setCursorPos(2,7) | |
| 199 | section3.write('Turbine:')
| |
| 200 | section3.setCursorPos(2,8) | |
| 201 | if message["turbine1rpm"] >= 1725 then | |
| 202 | section3.setTextColor(colors.green) | |
| 203 | elseif message["turbine1rpm"] >= 800 then | |
| 204 | section3.setTextColor(colors.orange) | |
| 205 | else | |
| 206 | section3.setTextColor(colors.red) | |
| 207 | end | |
| 208 | section3.write('RPM: '..message["turbine1rpm"]..'')
| |
| 209 | section3.setCursorPos(2,9) | |
| 210 | if message["turbine1Flow"] >= 1950 then | |
| 211 | section3.setTextColor(colors.green) | |
| 212 | elseif message["turbine1Flow"] >= 1000 then | |
| 213 | section3.setTextColor(colors.orange) | |
| 214 | else | |
| 215 | section3.setTextColor(colors.red) | |
| 216 | end | |
| 217 | section3.write('Flow Rate: '..message["turbine1Flow"]..'mb/t')
| |
| 218 | section3.setCursorPos(2,10) | |
| 219 | if message["turbine1RFT"] >= 25000 then | |
| 220 | section3.setTextColor(colors.green) | |
| 221 | elseif message["turbine1RFT"] >= 14000 then | |
| 222 | section3.setTextColor(colors.orange) | |
| 223 | else | |
| 224 | section3.setTextColor(colors.red) | |
| 225 | end | |
| 226 | section3.write('Generation: '..message["turbine1RFT"]..' rf/t')
| |
| 227 | section3.setCursorPos(2,11) | |
| 228 | if message["turbine1capacitor"] >= 900000 then | |
| 229 | section3.setTextColor(colors.green) | |
| 230 | elseif message["turbine1capacitor"] >= 400000 then | |
| 231 | section3.setTextColor(colors.orange) | |
| 232 | else | |
| 233 | section3.setTextColor(colors.red) | |
| 234 | end | |
| 235 | section3.write('Capacitor: '..message["turbine1capacitor"]..'')
| |
| 236 | section3.setCursorPos(2,13) | |
| 237 | section3.setTextColor(colors.white) | |
| 238 | section3.write('Reactor:')
| |
| 239 | section3.setCursorPos(2,14) | |
| 240 | if message["reactor1Temp"] <= 700 then | |
| 241 | section3.setTextColor(colors.green) | |
| 242 | elseif message["reactor1Temp"] <= 800 then | |
| 243 | section3.setTextColor(colors.orange) | |
| 244 | else | |
| 245 | section3.setTextColor(colors.red) | |
| 246 | end | |
| 247 | section3.write('Temp: '..message["reactor1Temp"]..'')
| |
| 248 | section3.setCursorPos(2,15) | |
| 249 | if message["reactor1Steam"] >= 1950 then | |
| 250 | section3.setTextColor(colors.green) | |
| 251 | elseif message["reactor1Steam"] >= 1000 then | |
| 252 | section3.setTextColor(colors.orange) | |
| 253 | else | |
| 254 | section3.setTextColor(colors.red) | |
| 255 | end | |
| 256 | section3.write('Steam Pressure: '..message["reactor1Steam"]..'')
| |
| 257 | section3.setCursorPos(2,16) | |
| 258 | if message["reactor1Fuel"] <= 0.06 then | |
| 259 | section3.setTextColor(colors.green) | |
| 260 | elseif message["reactor1Fuel"] <= 0.05 then | |
| 261 | section3.setTextColor(colors.orange) | |
| 262 | else | |
| 263 | section3.setTextColor(colors.red) | |
| 264 | end | |
| 265 | section3.write('Fuel Consumption: '..message["reactor1Fuel"]..'')
| |
| 266 | ||
| 267 | elseif id == 161 then | |
| 268 | section4.clear() | |
| 269 | section4.setTextColor(colors.yellow) | |
| 270 | section4.drawBorder('#','#','+')
| |
| 271 | section4.setCursorPos(2,3) | |
| 272 | section4.setTextColor(colors.white) | |
| 273 | section4.write('Turbine - Reactor Bank 2')
| |
| 274 | section4.setCursorPos(2,4) | |
| 275 | section4.write('Data Broadcast Received')
| |
| 276 | section4.setCursorPos(2,5) | |
| 277 | section4.write('System Status')
| |
| 278 | section4.setCursorPos(2,7) | |
| 279 | section4.write('Turbine:')
| |
| 280 | section4.setCursorPos(2,8) | |
| 281 | if message["turbine1rpm"] >= 1725 then | |
| 282 | section4.setTextColor(colors.green) | |
| 283 | elseif message["turbine1rpm"] >= 800 then | |
| 284 | section4.setTextColor(colors.orange) | |
| 285 | else | |
| 286 | section4.setTextColor(colors.red) | |
| 287 | end | |
| 288 | section4.write('RPM: '..message["turbine1rpm"]..'')
| |
| 289 | section4.setCursorPos(2,9) | |
| 290 | if message["turbine1Flow"] >= 1950 then | |
| 291 | section4.setTextColor(colors.green) | |
| 292 | elseif message["turbine1Flow"] >= 1000 then | |
| 293 | section4.setTextColor(colors.orange) | |
| 294 | else | |
| 295 | section4.setTextColor(colors.red) | |
| 296 | end | |
| 297 | section4.write('Flow Rate: '..message["turbine1Flow"]..'mb/t')
| |
| 298 | section4.setCursorPos(2,10) | |
| 299 | if message["turbine1RFT"] >= 25000 then | |
| 300 | section4.setTextColor(colors.green) | |
| 301 | elseif message["turbine1RFT"] >= 14000 then | |
| 302 | section4.setTextColor(colors.orange) | |
| 303 | else | |
| 304 | section4.setTextColor(colors.red) | |
| 305 | end | |
| 306 | section4.write('Generation: '..message["turbine1RFT"]..' rf/t')
| |
| 307 | section4.setCursorPos(2,11) | |
| 308 | if message["turbine1capacitor"] >= 900000 then | |
| 309 | section4.setTextColor(colors.green) | |
| 310 | elseif message["turbine1capacitor"] >= 400000 then | |
| 311 | section4.setTextColor(colors.orange) | |
| 312 | else | |
| 313 | section4.setTextColor(colors.red) | |
| 314 | end | |
| 315 | section4.write('Capacitor: '..message["turbine1capacitor"]..'')
| |
| 316 | section4.setCursorPos(2,13) | |
| 317 | section4.setTextColor(colors.white) | |
| 318 | section4.write('Reactor:')
| |
| 319 | section4.setCursorPos(2,14) | |
| 320 | if message["reactor1Temp"] <= 700 then | |
| 321 | section4.setTextColor(colors.green) | |
| 322 | elseif message["reactor1Temp"] <= 800 then | |
| 323 | section4.setTextColor(colors.orange) | |
| 324 | else | |
| 325 | section4.setTextColor(colors.red) | |
| 326 | end | |
| 327 | section4.write('Temp: '..message["reactor1Temp"]..'')
| |
| 328 | section4.setCursorPos(2,15) | |
| 329 | if message["reactor1Steam"] >= 1950 then | |
| 330 | section4.setTextColor(colors.green) | |
| 331 | elseif message["reactor1Steam"] >= 1000 then | |
| 332 | section4.setTextColor(colors.orange) | |
| 333 | else | |
| 334 | section4.setTextColor(colors.red) | |
| 335 | end | |
| 336 | section4.write('Steam Pressure: '..message["reactor1Steam"]..'')
| |
| 337 | section4.setCursorPos(2,16) | |
| 338 | if message["reactor1Fuel"] <= 0.06 then | |
| 339 | section4.setTextColor(colors.green) | |
| 340 | elseif message["reactor1Fuel"] <= 0.05 then | |
| 341 | section4.setTextColor(colors.orange) | |
| 342 | else | |
| 343 | section4.setTextColor(colors.red) | |
| 344 | end | |
| 345 | section4.write('Fuel Consumption: '..message["reactor1Fuel"]..'')
| |
| 346 | end | |
| 347 | ||
| 348 | end |