Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- a_direction = "back"
- mon_direction = "top"
- iteration = 1
- percent = {}
- a = peripheral.wrap(a_direction)
- mon = peripheral.wrap(mon_direction)
- term.redirect(mon)
- term.setTextColor(colors.red)
- monitor_width, monitor_height = term.getSize()
- function get_percent()
- return (a.getFreeBytes() / a.getTotalBytes()) * 100
- end
- function display(percent)
- --width = (percent/100) * monitor_width
- for i=1,monitor_width do
- paintutils.drawLine(i, 0, i, monitor_height, colors.blue)
- end
- columns_to_display = math.min(monitor_width, table.getn(percent))
- for i=1,columns_to_display do
- term.write(tostring(percent[table.getn(percent) - columns_to_display + i]))
- paintutils.drawLine(i, 0, i, monitor_height, colors.white)
- end
- term.setCursorPos(1,1)
- term.write("change in fullness")
- end
- function main()
- percent[iteration] = get_percent()
- iteration = iteration + 1
- while true do
- percent[iteration] = get_percent()
- display(percent)
- iteration = iteration + 1
- sleep(1)
- end
- end
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement