Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- me = peripheral.wrap("me_drive_0")
- m = peripheral.wrap("top")
- msize = {m.getSize()}
- function draw_line(x, y, length, color)
- mon.setBackgroundColor(color)
- mon.setCursorPos(x,y)
- mon.write(string.rep(" ", length))
- end
- function progress_bar(x, y, length, minVal, maxVal, bar_color, bg_color)
- draw_line(x, y, length, bg_color) --backgoround bar
- local barSize = math.floor((minVal/maxVal) * length)
- draw_line(x, y, barSize, bar_color) --progress so far
- end
- function drawScreen()
- m.clear()
- m.setCursorPos(1,1)
- m.setBackgroundColor(colors.blue)
- for i = 1,msize[1] do
- m.write(" ")
- end
- m.setCursorPos(1,msize[2])
- --for i = 1,msize[1] do
- m.write(" SpaceJunkies MESys Control! ")
- --end
- m.setBackgroundColor(colors.black)
- m.setTextColor(colors.yellow)
- m.setCursorPos(2,3)
- m.write("Status: ")
- if me.getUnusedBytes() == 0 then
- m.setTextColor(colors.red)
- m.write("Offline")
- else
- m.setTextColor(colors.lime)
- m.write("Online")
- m.setCursorPos(2,5)
- m.setTextColor(colors.yellow)
- m.write("Storage Used: ")
- gub = tonumber(me.getTotalBytes())-tonumber(me.getFreeBytes())
- pc = (gub/tonumber(me.getTotalBytes()))*100
- if string.find(pc,".") then
- find = string.find(pc,".")
- pc = string.sub(pc,1,find+1)
- end
- m.write(pc.."%")
- end
- end
- drawScreen()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement