Advertisement
Skeleton022

Untitled

Apr 24th, 2020
19
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.09 KB | None | 0 0
  1. local capacitor_1 = peripheral.wrap("capacitor_bank_1")
  2. local monitor = peripheral.wrap("monitor_0")
  3. monitor.setTextColor(1) --text will be white
  4. monitor.setBackgroundColor(128) --background will be gray
  5. monitor.clear() --paint the background
  6. i = 1
  7. --percentage math constants
  8. makePercent = 100
  9. capacitorCount = 5
  10. capacitorBasic = 1000000
  11. capacitorStandard = 5000000
  12. capacitorVibrant = 25000000
  13. totalCapacity = (capacitorCount) * (capacitorStandard)
  14. fillPercentage = 0
  15. difference = 0
  16. while true do
  17. energyLevel1 = capacitor_1.getEnergyStored()
  18. energyAdjusted = (energyLevel1) * (capacitorCount)
  19. --print(energyAdjusted)
  20. fillLevel = (4500000) * (capacitorCount)
  21. lowFillLevel = (3000000) * (capacitorCount)
  22. if energyAdjusted > fillLevel then
  23. redstone.setOutput("bottom", true)
  24. monitor.setCursorPos(6, 5)
  25. monitor.setTextColor(16384) --text will be red
  26. monitor.write("Generators Inactive")
  27. end
  28. if redstone.getOutput("bottom") == true then
  29. monitor.setCursorPos(6, 5)
  30. monitor.setTextColor(16384) --text will be red
  31. monitor.write("Generators Inactive")
  32. end
  33. if redstone.getOutput("bottom") == false then
  34. monitor.setCursorPos(7,5)
  35. monitor.setTextColor(8192) --text will be green
  36. monitor.write("Generators Active")
  37. end
  38. if energyAdjusted < lowFillLevel then
  39. redstone.setOutput("bottom", false)
  40. monitor.setCursorPos(7,5)
  41. monitor.setTextColor(8192) --text will be green
  42. monitor.write("Generators Active")
  43. end
  44. monitor.setCursorPos(1,1)
  45. print("Generators with start at "..lowFillLevel.." RF")
  46. print("Current energy storage is "..energyAdjusted.." RF")
  47. --monitor.write("Current energy storage is "..energyAdjusted.." RF")
  48. difference = (totalCapacity) - (energyAdjusted)
  49. fillAmount = (energyAdjusted) / (totalCapacity)
  50. fillPercentage = (fillAmount) * (100)
  51. fillInt = math.floor(fillPercentage)
  52. monitor.setCursorPos(3,2)
  53. monitor.setTextColor(1)
  54. monitor.write("Currently at "..fillInt.."% capacity")
  55. --monitor.write(string.format("%.2fillPercentage", fillPercentage))
  56. sleep(2.5)
  57. monitor.clear()
  58. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement