Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- modem = peripheral.wrap("left")
- modem.open(1)
- mon = peripheral.wrap("right")
- monX, monY = mon.getSize()
- max = modem.callRemote("draconic_rf_storage_3", "getMaxEnergyStored")
- current = modem.callRemote("draconic_rf_storage_3", "getEnergyStored")
- print(current)
- print(max)
- function drawLine(x, y, length, size, color_bar)
- for yPos = y, y+size-1 do
- mon.setBackgroundColor(color_bar)
- mon.setCursorPos(x, yPos)
- mon.write(string.rep(" ", length))
- end
- end
- function drawProg(x, y, length, size, minVal, maxVal)
- drawLine(x, y, length, size, colors.gray)
- local barSize = math.floor((minVal/maxVal)*length)
- drawLine(x, y, barSize, size, colors.green)
- end
- while true do
- mon.clear()
- drawProg(25, monY-5, monX-27, 4, current, max)
- max = modem.callRemote("draconic_rf_storage_3", "getMaxEnergyStored")
- current = modem.callRemote("draconic_rf_storage_3", "getEnergyStored")
- percent = current/max*100
- mon.setCursorPos(25, monY-7)
- mon.setBackgroundColor(colors.black)
- mon.write("["..math.floor(percent).."%]")
- os.sleep(1)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement