Advertisement
Xenogami

xpturtle

Jul 6th, 2013
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.81 KB | None | 0 0
  1. hb = true
  2. m=peripheral.wrap("right")
  3. m.setAutoCollect(true)
  4.  
  5. local function getBook()
  6.     hb = false
  7.     turtle.turnLeft()
  8.     turtle.select(1)
  9.     turtle.suck()
  10.     if turtle.getItemCount(1) > 1 then
  11.         turtle.transferTo(2, 1)
  12.         turtle.drop()
  13.         hb = true
  14.     end
  15.     turtle.turnRight()
  16. end
  17.  
  18. local function enchantBook()
  19.     turtle.select(2)
  20.     m.enchant(30)
  21. end
  22.  
  23. local function dropBook()
  24.     turtle.turnRight()
  25.     turtle.select(2)
  26.     if not turtle.drop() then
  27.         print("No Space")
  28.         turtle.turnLeft()
  29.         os.shutdown()
  30.     end
  31.     turtle.turnLeft()
  32. end
  33.  
  34. local function firstRun()
  35.     while turtle.detect() do
  36.         turtle.turnRight()
  37.     end
  38.     turtle.select(1)
  39.     if turtle.getItemCount(2) > 1 then
  40.         dropBook()
  41.     end
  42. end
  43.  
  44. firstRun()
  45. while hb do
  46.     if m.getLevels() > 30 then
  47.         getBook()
  48.         enchantBook()
  49.         dropBook()
  50.     end
  51.     os.sleep(10)
  52. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement