Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ---------------
- -- BY UPZONE --
- ---------------
- os.loadAPI("builder\\apis\\Colors")
- function getItemCount(slots)
- count = 0
- for i, v in pairs(slots) do
- count = count + turtle.getItemCount(v)
- end
- return count
- end
- function itemCountStatus(count, slots)
- currentCount = getItemCount(slots)
- if currentCount > count then
- currentCount = count
- end
- countStringLength = string.len(tostring(count))
- text = string.format("[%0" .. countStringLength.. "d/" .. count .. "]", currentCount)
- if currentCount >= count then
- -- enough items
- term.blit(text, string.rep(Colors.lime, string.len(text)), string.rep(Colors.black, string.len(text)))
- return true
- else
- -- not enough
- term.blit(text, string.rep(Colors.red, string.len(text)), string.rep(Colors.black, string.len(text)))
- return false
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement