Advertisement
gunny576

Display_turbine

Apr 7th, 2016
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.10 KB | None | 0 0
  1. r = {}
  2. r[2] = peripheral.wrap("BigReactors-Turbine_2")
  3. r[3] = peripheral.wrap("BigReactors-Turbine_3")
  4. r[4] = peripheral.wrap("BigReactors-Turbine_4")
  5. r[5] = peripheral.wrap("BigReactors-Turbine_5")
  6. r[6] = peripheral.wrap("BigReactors-Turbine_6")
  7. r[7] = peripheral.wrap("BigReactors-Turbine_7")
  8. r[8] = peripheral.wrap("BigReactors-Turbine_8")
  9. r[9] = peripheral.wrap("BigReactors-Turbine_9")
  10. r[10] = peripheral.wrap("BigReactors-Turbine_10")
  11. m = peripheral.wrap("monitor_0")
  12. m.clear()
  13. m.setTextScale(2)
  14.  
  15.  
  16. m.setBackgroundColor(colors.black)
  17. m.write()
  18. j = 2
  19. while true do
  20.     for i =2, 10 do
  21.         m.setCursorPos(1,j-1)
  22.         m.write("Turbine "..i-1..": " .. math.floor(r[i].getRotorSpeed() + .5) .. " RPM")
  23.         charge= math.floor(math.floor(r[i].getRotorSpeed()+.5)/18)
  24.         m.setBackgroundColor(colors.black)
  25.         m.setCursorPos(1,j)
  26.         j = j +2
  27.         m.setBackgroundColor(colors.green)
  28.         for i = 0, math.floor(charge/10) do
  29.             m.write(" ")
  30.         end
  31.         m.setBackgroundColor(colors.red)
  32.         for i = 0, 9-math.floor(charge/10) do
  33.             m.write(" ")
  34.         end
  35.         m.setBackgroundColor(colors.black) 
  36.     end
  37.     os.sleep(1)
  38.     m.clear()
  39.     end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement