Advertisement
Guest User

startup

a guest
Feb 25th, 2017
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.37 KB | None | 0 0
  1. core = peripheral.wrap("draconic_storage_1")
  2. mon = peripheral.wrap("left")
  3. max = 2140000000000
  4. monX, monY = mon.getSize()
  5.  
  6.  
  7. function clear()
  8.   mon.setBackgroundColor(colors.black)
  9.   mon.clear()
  10.   mon.setCursorPos(1,1)
  11. end
  12.  
  13. function drawText(x, y, text, color_txt, color_bg)
  14.   mon.setTextColor(color_txt)
  15.   mon.setBackgroundColor(color_bg)
  16.   mon.setCursorPos(x,y)
  17.   mon.write(text)
  18. end
  19.  
  20. function drawLine(x, y, length, size, color_bar)
  21. for yPos = y, y+size-1 do
  22.   mon.setBackgroundColor(color_bar)
  23.   mon.setCursorPos(x, yPos)
  24.   mon.write(string.rep(" ", length))
  25.   end
  26. end
  27.  
  28. function drawProg(x, y, name, length, size, minVal, maxVal, color_bar, color_bg)
  29.   drawLine(x, y, length, size, color_bg)
  30.   local barSize = math.floor((minVal/maxVal)*length)
  31.   drawLine(x, y, barSize, size, color_bar)
  32.   local text = name .." ".. math.floor((minVal/maxVal)*100) .."%"
  33.   drawText(monX/2-#text/2, y+size/2, text, colors.black, colors.green)
  34. end
  35.  
  36. while true do
  37.  
  38.  local power = core.getEnergyStored()
  39.  local percent = math.floor((power/max)*100)
  40.  term.clear()
  41.  term.setCursorPos(1,1)
  42.  print("Receiving Energy Core Information")
  43.  mon.getSize()
  44.  mon.setCursorPos(1,1)
  45.  mon.setTextColor(colors.white)
  46.  mon.setTextScale(1)
  47.  mon.write("Current Power: " .. .." RF")
  48.  
  49.  drawProg(2, 5, "Core at ", monX-2, 3, percent, 100, colors.green, colors.red)
  50.  
  51. sleep(.2)
  52. clear()
  53.   end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement