Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function compactInv()
- for checkSlot = 1, 16 do
- if turtle.getItemCount(checkSlot) > 0 then
- turtle.select(checkSlot)
- for testSlot = checkSlot, 16 do
- if turtle.compareTo(testSlot) then
- turtle.select(testSlot)
- turtle.transferTo(checkSlot, turtle.getItemCount(testSlot))
- turtle.select(checkSlot)
- end
- end
- end
- end
- end
- function cleanUp()
- for checkSlot = 16, 1, -1 do
- while turtle.getItemCount(checkSlot) > 0 do
- moveSlot = 16
- turtle.select(checkSlot)
- while not turtle.transferTo(moveSlot, turtle.getItemCount(checkSlot)) do
- moveSlot = moveSlot - 1
- end
- if moveSlot == checkSlot then
- break
- end
- end
- end
- end
- function sortInv()
- for checkSlot = 16, 1, -1 do
- if turtle.getItemCount(checkSlot) > 0 then
- turtle.select(checkSlot)
- moveSlot = 1
- while not turtle.transferTo(moveSlot, turtle.getItemCount(checkSlot)) do
- moveSlot = moveSlot + 1
- end
- turtle.select(moveSlot)
- for testSlot = 16, 1, -1 do
- moveSlot2 = moveSlot
- if testSlot > moveSlot2 then
- if turtle.getItemCount(testSlot) > 0 then
- if turtle.compareTo(testSlot) then
- turtle.select(testSlot)
- while not turtle.transferTo(moveSlot2, turtle.getItemCount(testSlot)) do
- moveSlot2 = moveSlot2 + 1
- end
- turtle.select(moveSlot)
- end
- end
- end
- end
- end
- end
- end
- compactInv()
- cleanUp()
- sortInv()
- turtle.select(1)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement