theo33500

Untitled

Jun 20th, 2021
537
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. p = peripheral.find("draconic_rf_storage")
  2. m = peripheral.find("monitor")
  3. cent = "100"
  4. function clear()
  5.   m.clear()
  6.   m.setCursorPos(1,1)
  7.   term.setCursorPos(1,1)
  8.   term.clear()
  9. end
  10.  
  11. local x, y = m.getSize()
  12. local w2, h2 = term.getSize()
  13.  
  14. while true do
  15.   m.setBackgroundColor(colors.black)
  16.   energy = p.getEnergyStored()
  17.   max = p.getMaxEnergyStored()
  18.   pourcent1 = energy/max
  19.   pourcent2 = pourcent1*cent
  20.   clear()
  21.   m.write(energy.."/"..max)
  22.   m.setCursorPos(1,3)
  23.   m.write(pourcent2.."%")
  24.   maxE = math.floor(max/2.5)
  25.   curE = math.floor(energy/2.5)
  26.   bar = math.floor(((curE/maxE)*(x-2))+0.5)
  27.   stats = energy
  28.   m.setCursorPos(2, y-2)
  29.   m.setBackgroundColour(colors.gray)
  30.   m.write(string.rep(" ",x-2))
  31.   m.setCursorPos(2, y-2)
  32.   m.setBackgroundColour(colors.green)
  33.   m.write(string.rep(" ",bar))
  34.   sleep(1)
  35. end
RAW Paste Data