Advertisement
Guest User

startup

a guest
Mar 14th, 2014
211
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.96 KB | None | 0 0
  1. -- Energycells 1-5
  2. con = {
  3.   peripheral.wrap("cofh_thermalexpansion_energycell_17")
  4.   peripheral.wrap("cofh_thermalexpansion_energycell_18")
  5.   peripheral.wrap("cofh_thermalexpansion_energycell_19")
  6.   peripheral.wrap("cofh_thermalexpansion_energycell_20")
  7.   peripheral.wrap("cofh_thermalexpansion_energycell_21")
  8.   }
  9. -- Monitor
  10. local mon = peripheral.wrap('right')
  11. -- Reading the Amount of Energy
  12. function getEnergy(Str)
  13.   return con[Str].getEnergyStored("unknown")
  14. end
  15. -- Reading Max Energy
  16. function getMaxEnergy(Str)
  17.   return con[Str].getMaxEnergyStored("unknown")
  18. end
  19. -- Giving out a Percentage
  20. function percent(minVal, maxVal)
  21.   return math.floor((minVal/maxVal)*100)
  22. end
  23. -- Displaying the Amount of Energy and the Percentage of Energy on an monitor
  24. while true do
  25.   for i = 1, 5 do
  26.     mon.setCursorPos((i*2)-1, 1)
  27.     mon.write("Energycell "..i..": "..getEnergy(i).." Redstone Flux "..percent(getEnergy(i), getMaxEnergy(i)).."%")
  28.     sleep(1)
  29.   end
  30. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement