Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- me = peripheral.wrap("right")
- mon = peripheral.wrap("left")
- low = 32
- local meItems = {
- [1] = {"Yellorium","BigReactors:BRIngot","0"}
- }
- function checkMe(checkName, name)
- melist = me.getAvailableItems()
- for a = 1, #melist do
- itemName = melist[a].fingerprint.id .. melist[a].fingerprint.dmg
- value = tostring(melist[a].size)
- if itemName == checkName then
- centerT(name, row+2, colors.black , colors.blue , "left")
- if tonumber(value) <= low then
- centerT(value, row+2, colors.black , colors.red , "right")
- else
- centerT(value, row+2, colors.black , colors.green , "right")
- end
- end
- row = row+1
- end
- end
- function checkTable()
- clearScreen()
- row = 1
- for i = 1, #meItems do
- checkName = meItems[i][2] .. meItems[i][3]
- name = meItems[i][1]
- checkMe(checkName, name)
- end
- end
- function clearScreen()
- mon.setBackgroundColor(colors.black)
- mon.clear()
- mon.setCursorPos(1,1)
- centerT(" CMR v1.0 ",1,colors.blue , colors.white , "head")
- end
- function centerT(text,line,txtback,txtcolor,pos)
- print("Updating:" ..text)
- monX,monY = mon.getSize()
- mon.setBackgroundColor(txtback)
- mon.setTextColor(txtcolor)
- length = string.len(text)
- dif = math.floor(monX-length)
- x = math.floor(dif/2)
- if pos == "head" then
- mon.setCursorPos(x+1, line)
- mon.write(text)
- elseif pos == "left" then
- mon.setCursorPos(2,3)
- mon.write(text)
- elseif pos == "right" then
- mon.setCursorPos(monX-length, 3)
- mon.write(text)
- end
- end
- while true do
- checkTable()
- sleep(10)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement