Advertisement
Guest User

startup

a guest
Apr 9th, 2013
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.68 KB | None | 0 0
  1. local p = peripheral.wrap("right")
  2. local enchants = 0
  3. p.setAutoCollect(true)
  4.  
  5. while true do
  6.   local curLevel = p.getLevels()
  7.   term.clear()
  8.   term.setCursorPos(1,1)
  9.   print("Level: " .. curLevel)
  10.   print("Enchants: " .. enchants)
  11.   if curLevel >= 30 then
  12.     enchants = enchants + 1
  13.     print("Enchanting!")
  14.     turtle.select(1)
  15.     turtle.suck()
  16.     local count = turtle.getItemCount(1)-1
  17.     if count < 0 then
  18.        print("Ran out of books!")
  19.        while count < 0 do
  20.          turtle.suck()
  21.          count = turtle.getItemCount(1)-1
  22.          sleep(5)
  23.        end
  24.     end
  25.     turtle.drop(turtle.getItemCount(1)-1)
  26.     p.enchant(30)
  27.     turtle.drop()
  28.   end
  29.   sleep(1)
  30. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement