Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- direction="north"
- slotNum=2
- m=peripheral.wrap("front")
- function checkSlot(slot)
- stackInfo=m.getStackInSlot(slot)
- if stackInfo ~= nil then
- itemPresent=true
- else
- itemPresent=false
- end
- return itemPresent
- end
- function enchantThing(amount)
- while turtle.getItemCount(1)<tonumber(amount) do
- turtle.select(slotNum)
- turtle.transferTo(1)
- turtle.select(1)
- os.sleep(1)
- slotNum=slotNum+1
- if slotNum>16 then slotNum=2 end
- end
- turtle.drop(tonumber(amount))
- os.sleep(1)
- while checkSlot(0) do
- print("Waiting for current enchantment to finish.")
- os.sleep(10)
- end
- os.sleep(1)
- while checkSlot(1) do
- print("Taking out enchanted things.")
- m.push(direction,1,64)
- os.sleep(1)
- end
- end
- while 1 do
- shell.run("clear")
- while checkSlot(0) do
- print("Wait for current enchantment to finish.")
- os.sleep(10)
- end
- print("Specify amount of books to enchant at once:")
- atOnce=read()
- print("How many enchant attempts?")
- amount=read()
- for i=1,amount do
- enchantThing(atOnce)
- os.sleep(1)
- end
- print("Done. Enchanted "..atOnce*amount.." items!")
- print("Press any button to reset turtle.")
- os.pullEvent()
- end
Advertisement
Add Comment
Please, Sign In to add comment