subzero22

Draconic Energy Storage

Sep 20th, 2016
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. drac = peripheral.wrap("draconic_rf_storage_3")
  2. drmon = peripheral.wrap("monitor_22")
  3.  
  4. function clear()
  5. term.clear()
  6. drmon.clear()
  7. term.setCursorPos(1,1)
  8. drmon.setCursorPos(1,1)
  9. end
  10.  
  11. while true do
  12.  
  13.   clear()
  14.  
  15.   totalPercent = drac.getEnergyStored() / drac.getMaxEnergyStored() * 100
  16.  
  17.   term.setCursorPos(14,1)
  18.   drmon.setCursorPos(5,3)
  19.   print("Draconic Energy Core")
  20.   drmon.write("Draconic Energy Core")
  21.  
  22.   term.setCursorPos(19,3)
  23.   drmon.setCursorPos(9,5)
  24.   print("Power: "..math.floor(totalPercent + .5).."%")
  25.   drmon.write("Power: "..math.floor(totalPercent + .5).."%")
  26.  
  27.   drmon.setCursorPos(9,6)
  28.    if totalPercent <= 9 then
  29.      drmon.setBackgroundColor(colors.white)
  30.      drmon.write("          ")
  31.    elseif totalPercent <= 19 then
  32.      drmon.setBackgroundColor(colors.red)
  33.      drmon.write(" ")
  34.      drmon.setBackgroundColor(colors.white)
  35.      drmon.write("         ")
  36.    elseif totalPercent <= 29 then
  37.      drmon.setBackgroundColor(colors.red)
  38.      drmon.write("  ")
  39.      drmon.setBackgroundColor(colors.white)
  40.      drmon.write("        ")
  41.    elseif totalPercent <= 39 then
  42.      drmon.setBackgroundColor(colors.red)
  43.      drmon.write("   ")
  44.      drmon.setBackgroundColor(colors.white)
  45.      drmon.write("       ")
  46.    elseif totalPercent <= 49 then
  47.      drmon.setBackgroundColor(colors.red)
  48.      drmon.write("    ")
  49.      drmon.setBackgroundColor(colors.white)
  50.      drmon.write("      ")
  51.    elseif totalPercent <= 59 then
  52.      drmon.setBackgroundColor(colors.red)
  53.      drmon.write("     ")
  54.      drmon.setBackgroundColor(colors.white)
  55.      drmon.write("     ")
  56.    elseif totalPercent <= 69 then
  57.      drmon.setBackgroundColor(colors.red)
  58.      drmon.write("      ")
  59.      drmon.setBackgroundColor(colors.white)
  60.      drmon.write("    ")
  61.    elseif totalPercent <= 79 then
  62.      drmon.setBackgroundColor(colors.red)
  63.      drmon.write("       ")
  64.      drmon.setBackgroundColor(colors.white)
  65.      drmon.write("   ")
  66.    elseif totalPercent <= 89 then
  67.      drmon.setBackgroundColor(colors.red)
  68.      drmon.write("        ")
  69.      drmon.setBackgroundColor(colors.white)
  70.      drmon.write("  ")
  71.    elseif totalPercent >= 90 then
  72.      drmon.setBackgroundColor(colors.red)
  73.      drmon.write("          ")
  74.    elseif totalPercent >= 90 then
  75.      drmon.setBackgroundColor(colors.red)
  76.      drmon.write("         ")
  77.      drmon.setBackgroundColor(colors.white)
  78.      drmon.write(" ")
  79.    end
  80.   drmon.setBackgroundColor(colors.black)
  81.        
  82.   term.setCursorPos(1,6)
  83.   drmon.setCursorPos(1,8)
  84.   print("Current RF: "..drac.getEnergyStored())
  85.   drmon.write("Current RF: "..drac.getEnergyStored())
  86.  
  87.   term.setCursorPos(1,7)
  88.   drmon.setCursorPos(1,9)
  89.   print("    Max RF: "..drac.getMaxEnergyStored())
  90.   drmon.write("    Max RF: "..drac.getMaxEnergyStored())
  91.  
  92.   sleep(1)
  93. end
Add Comment
Please, Sign In to add comment