SHARE
TWEET

Untitled

Zeide_ May 22nd, 2019 53 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. local mon = peripheral.find("monitor")
  2. local core = peripheral.find("draconic_rf_storage")
  3. local energyStored = core.getEnergyStored()
  4. local function round(n)
  5.     return n % 1 >= 0.5 and math.ceil(n) or math.floor(n)
  6. end
  7.  
  8. if energyStored < 1000 then
  9.     mon.write(energyStored)
  10. elseif energyStored < 1000000 then
  11.     mon.write(round(energyStored/1000))
  12.     mon.write("k")
  13. elseif energyStored < 1000000000 then
  14.     mon.write(round(energyStored/1000000))
  15.     mon.write("M")
  16. elseif energyStored < 1000000000000 then
  17.     mon.write(round(energyStored/1000000000))
  18.     mon.write("G")
  19. elseif energyStored < 1000000000000000 then
  20.     mon.write(round(energyStored/1000000000000))
  21.     mon.write("T")
  22. elseif energyStored < 1000000000000000000 then
  23.     mon.write(round(energyStored/1000000000000000))
  24.     mon.write("P")
  25. elseif energyStored < 1000000000000000000000 then
  26.     mon.write(round(energyStored/1000000000000000000))
  27.     mon.write("E")
  28. end
  29. mon.write("RF")
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top