Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local s = 0
- local l = 16
- local function stack()
- print("Stacking Items")
- for i=1,15 do
- s = turtle.getItemSpace(i)
- for j=i+1,l do
- turtle.select(j)
- if turtle.compareTo(i) then
- turtle.transferTo(i,s)
- if turtle.getItemSpace(i) == 0 then
- break
- end
- end
- end
- end
- end
- local function compact()
- print("Compressing Open Space")
- for i=1,l do
- if turtle.getItemCount(i) == 0 then
- for j=i+1,l do
- if turtle.getItemCount(j) > 0 then
- turtle.select(j)
- turtle.transferTo(i)
- break
- end
- end
- end
- end
- end
- local function vSpace()
- if s == 1 then
- print("Verified space")
- return
- else
- print("Not enough space. Please clear at least 1 slot and press enter")
- read()
- space()
- end
- end
- local function space()
- print("Checking for available space")
- s = 0
- for i=1,16 do
- if turtle.getItemCount(i) == 0 then
- s = 1
- l = i-1
- break
- end
- end
- vSpace()
- end
- local function sort()
- print("Commensing sorting")
- for i=1,l-1 do
- for j=i+2,l+1 do
- turtle.select(j)
- if turtle.compareTo(i) then
- turtle.select(i+1)
- turtle.transferTo(l+1,64)
- turtle.select(j)
- turtle.transferTo(i+1,64)
- turtle.select(l+1)
- turtle.transferTo(j,64)
- break
- end
- end
- end
- l=l+1
- compact()
- stack()
- turtle.select(1)
- end
- stack()
- compact()
- space()
- sort()
Advertisement
Add Comment
Please, Sign In to add comment