Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- m=peripheral.wrap("right")
- m.setAutoCollect(true)
- function levelCheck()
- level = m.getLevels()
- shell.run("clear")
- print ("Currently level: "..level)
- return level
- end
- function getBook()
- local bookCount
- local toReturn
- turtle.suckUp()
- bookCount = turtle.getItemCount(1)
- if bookCount == 0 then
- while bookCount == 0 do
- shell.run("clear")
- print ("Please Reload the Chest")
- sleep(1)
- turtle.suckUp()
- bookCount = turtle.getItemCount(1)
- end
- end
- if bookCount ~= 0 then do
- print("Returning Books")
- sleep(2)
- returnBooks(bookCount)
- print("Extra books returned")
- end
- end
- end
- function returnBooks(x)
- x = x-1
- print("Returning "..x.." books")
- sleep(4)
- turtle.transferTo(2, x)
- turtle.select(2)
- turtle.dropUp()
- turtle.select(1)
- end
- while true do
- local lv = levelCheck()
- if lv >= 30 then
- getBook()
- m.enchant(30)
- turtle.drop()
- end
- sleep (2)
- end
Advertisement
Add Comment
Please, Sign In to add comment