Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Version simple pour afficher une fois sur le monitor
- local backpack = peripheral.wrap("right") -- Changez la direction
- local monitor = peripheral.wrap("top") -- Changez la direction
- if not backpack or not monitor then
- print("Vérifiez les connexions du sac et du monitor")
- return
- end
- -- Rediriger vers le monitor
- term.redirect(monitor)
- monitor.setTextScale(0.5)
- -- Effacer l'écran
- term.clear()
- term.setCursorPos(1, 1)
- -- Affichage
- print("=== CONTENU DU SAC ===")
- print()
- local items = {}
- for slot = 1, backpack.size() do
- local item = backpack.getItemDetail(slot)
- if item then
- local name = item.displayName or item.name
- items[name] = (items[name] or 0) + item.count
- end
- end
- if next(items) == nil then
- print("Sac vide")
- else
- for name, count in pairs(items) do
- print(count .. "x " .. name)
- end
- end
- print()
- print("MAJ: " .. textutils.formatTime(os.time(), false))
- -- Revenir au terminal principal
- term.redirect(term.native())
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement