Advertisement
kacsavadasz10

Untitled

Nov 11th, 2017
231
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.28 KB | None | 0 0
  1. --1.5.2 EnderIO Capacitor Bank, energy generation control, and monitor program, by: Kacsa
  2. --Beállítások
  3. capacitor = peripheral.wrap("top")
  4. m = peripheral.wrap("monitor_2")
  5. cap = 4000000
  6. max = 90
  7. min = 10
  8.  
  9. --Monitor
  10. m.setTextColor(2)
  11. m.setBackgroundColor(1)
  12. m.clear()
  13.  
  14. --MonitorMéret
  15. maxw, maxh = m.getSize()
  16. centerw = (maxw) / 2
  17. centerh = (maxh) / 2
  18.  
  19. --Script
  20. while true do
  21.  
  22. --Százalék
  23. i = 1
  24. energyLevel = capacitor.getEnergyStored()
  25. makePercent = 100
  26. difference = (cap) - (energyLevel)
  27. fillAmount = (energyLevel) / (cap)
  28. fillPercentage = (fillAmount) * (100)
  29. fillInt = math.floor(fillPercentage)
  30.  
  31.  
  32. if fillInt < min then
  33. redstone.setOutput("right", true)
  34. m.setCursorPos(centerw - 8, centerh + 2)
  35. m.setTextColor(16384)
  36. m.write("Energy generation active")
  37. end
  38. if fillInt > max then
  39. redstone.setOutput("right", false)
  40. m.setCursorPos(centerw - 8, centerh + 1)
  41. m.setTextColor(32)
  42. m.write("Energy generation inactive")
  43. end
  44.  
  45. --DeBug
  46. print("Generation will start under "..min.."%")
  47. print("Stored: "..energyLevel.."MJ")
  48.  
  49.  
  50. --Monitor
  51. m.setTextColor(3)
  52. m.setCursorPos(centerw - 12, 1)
  53. m.write("Stored: "..energyLevel.."MJ")
  54. m.setCursorPos(maxw - 11, 1)
  55. m.write("Energy: "..fillInt.."%")
  56.  
  57. --End
  58. sleep(2.5)
  59. m.clear()
  60. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement