Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ArmorHotbar="west"
- Inventory="east"
- transferToChests=0
- function transferInventory()
- --print("entering function")
- local pim=peripheral.wrap("top")
- while pim.getInventoryName() ~= "container.inventory" do
- sleep(0)
- end
- --print(pim.getInventoryName())
- if pim.getInventoryName() == "container.inventory" then
- for w=1,40 do
- --print("checking slot "..w)
- sleep(0)
- if pim.getStackInSlot(w) ~= nil then
- transferToChests=1
- break
- end
- end
- if transferToChests==0 then
- --print("transferToChests equals 0")
- local ender1=peripheral.wrap("left")
- local ender2=peripheral.wrap("right")
- for w=1,27 do
- sleep(0)
- pim.pullItemIntoSlot(Inventory,w,64,w+9)
- end
- for w=1,13 do
- sleep(0)
- if w<=9 then
- pim.pullItemIntoSlot(ArmorHotbar,w,64,w)
- else
- pim.pullItemIntoSlot(ArmorHotbar,w,64,w+27)
- end
- end
- else
- --print("transferToChests equals 1")
- --transfer items into chests
- for x=10,36 do
- sleep(0)
- pim.pushItemIntoSlot(Inventory,x,64,x-9)
- end
- for x=1,9 do
- sleep(0)
- pim.pushItemIntoSlot(ArmorHotbar,x,64,x)
- end
- for x=37,40 do
- sleep(0)
- pim.pushItemIntoSlot(ArmorHotbar,x,64,x-27)
- end
- end
- else
- sleep(0)
- end
- end
- while 1 do
- os.pullEvent("redstone")
- os.pullEvent("redstone")
- transferToChests=0
- transferInventory()
- os.pullEvent("redstone")
- end
Advertisement
Add Comment
Please, Sign In to add comment