SHARE
TWEET

powermo

a guest Aug 23rd, 2019 68 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. modem = peripheral.wrap("left")
  2. modem.open(1)
  3.  
  4. mon = peripheral.wrap("right")
  5. monX, monY = mon.getSize()
  6.  
  7. max = modem.callRemote("draconic_rf_storage_3", "getMaxEnergyStored")
  8. current = modem.callRemote("draconic_rf_storage_3", "getEnergyStored")
  9.  
  10. print(current)
  11. print(max)
  12.  
  13.  
  14.  
  15. function drawLine(x, y, length, size, color_bar)
  16.     for yPos = y, y+size-1 do
  17.       mon.setBackgroundColor(color_bar)
  18.       mon.setCursorPos(x, yPos)
  19.       mon.write(string.rep(" ", length))
  20.      end
  21.   end
  22.    
  23.   function drawProg(x, y, length, size, minVal, maxVal)
  24.     drawLine(x, y, length, size, colors.gray)
  25.     local barSize = math.floor((minVal/maxVal)*length)
  26.     drawLine(x, y, barSize, size, colors.green)
  27.   end
  28.  
  29. while true do
  30.  
  31.   mon.clear()
  32.   drawProg(25, monY-5, monX-27, 4, current, max)
  33.  
  34.   max = modem.callRemote("draconic_rf_storage_3", "getMaxEnergyStored")
  35.   current = modem.callRemote("draconic_rf_storage_3", "getEnergyStored")
  36.   percent = current/max*100
  37.  
  38.   mon.setCursorPos(25, monY-7)
  39.   mon.setBackgroundColor(colors.black)
  40.   mon.write("["..math.floor(percent).."%]")
  41.   os.sleep(1)
  42. end
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