Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local mon=peripheral.wrap("monitor_2")
- local ae=peripheral.wrap("appeng_me_tilecontroller_0")
- local mon_h,mon_v=mon.getSize()
- local timer=os.startTimer(5)
- local function setupScreen()
- mon.setBackgroundColor(colours.black)
- mon.clear()
- mon.setCursorPos(1,mon_v)
- mon.setBackgroundColor(colours.white)
- mon.setTextColor(colours.black)
- mon.write(string.rep(" ",mon_h))
- mon.setCursorPos(2,mon_v)
- mon.write("AE")
- end
- local function iif(c,y,n)
- if c then return y end
- return n
- end
- local function updateMonitorAE()
- local freeBytes = 0 + ae.getFreeBytes()
- local totalBytes = 0 + ae.getTotalBytes()
- mon.setCursorPos(5,mon_v)
- mon.setBackgroundColor(colours.white)
- mon.setTextColor(iif(freeBytes>totalBytes/2,colors.black,iif(freeBytes<1000,colors.red,colours.green)))
- mon.write(ae.getFreeBytes())
- mon.setTextColor(colors.black)
- mon.write("/"..ae.getTotalBytes().." Bytes ")
- mon.write(" "..ae.getStoredItemCount().." Items stored ")
- end
- setupScreen()
- updateMonitorAE()
- while true do
- local e,p = os.pullEvent()
- if e=="timer" and p==timer then
- updateMonitorAE()
- sleep(5)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement