Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- m = peripheral.wrap("right")
- fullToDeliver = 3
- lastEmptySlot = 14
- fullBattery = 15
- emptyBattery = 16
- function clearScreen()
- term.clear()
- term.setCursorPos(1,1)
- end
- function isCurrentSlotFullBattery()
- return turtle.compareTo(fullBattery)
- end
- function isSlotEmptyBattery()
- return turtle.compareTo(emptyBattery)
- end
- function isSlotHalfBattery(i)
- return not (isCurrentSlotFullBattery or isSlotEmptyBattery or isSlotEmpty(i))
- end
- function isSlotEmpty(i)
- return turte.getItemCount(i) == 0
- end
- turtle.select(1)
- clearScreen()
- while true do
- clearScreen()
- print("=========================")
- turtle.select(1)
- -- Suck all the items in the ender chest
- while turtle.suckUp() do
- os.sleep(1)
- end
- m.suckSneaky(1,1)
- -- Go through all the sucked items in the inventory
- for i=1,lastEmptySlot do
- turtle.select(i)
- if isCurrentSlotFullBattery() then
- print("Putting a full battery in the chest")
- turtle.dropUp()
- elseif isSlotEmptyBattery() or isSlotHalfBattery(i) then
- print("Putting an empty or not fully charged battery in the battery box")
- m.dropSneaky(1,1)
- end
- os.sleep(1)
- end
- os.sleep(5)
- end
Advertisement
Add Comment
Please, Sign In to add comment