Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local chest = peripheral.wrap("left")
- local monitor = peripheral.wrap("top")
- while true do
- local totalSlots = chest.size() -- Toplam slot sayısı
- local items = chest.list()
- local filledSlots = 0
- -- Her bir öğeyi işle
- for _, item in ipairs(items) do
- if item.count == 64 then -- Eğer öğenin tüm yuvaları dolu ise
- filledSlots = filledSlots + 1
- else
- -- Eğer öğenin yuvalarının bir kısmı dolu ise, dolu slot sayısını yuva sayısına ekle
- filledSlots = filledSlots + math.ceil(item.count / 64)
- end
- end
- local emptySlots = totalSlots - filledSlots -- Boş slot sayısı hesaplama
- monitor.clear()
- monitor.setTextScale(1.1)
- monitor.setBackgroundColor(colors.white)
- monitor.setCursorPos(1, 1)
- monitor.setTextColor(colors.black)
- monitor.write("Free slots: " .. emptySlots)
- monitor.setCursorPos(1, 2)
- monitor.write("Total slots: " .. totalSlots)
- sleep(0.1)
- end
Add Comment
Please, Sign In to add comment