Neopherus

AutoEnchant test v2

Apr 17th, 2013
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.85 KB | None | 0 0
  1. term.clear()
  2. m=peripheral.wrap("right")
  3. m.setAutoCollect(true)
  4. turtle.select(1)
  5. local level = 0
  6. --
  7.  
  8.  
  9. function turnaround()
  10. turtle.turnRight()
  11. turtle.turnRight()
  12. end
  13.  
  14. function check()
  15.  if turtle.getItemCount(8) >0 then
  16.  turnaround()
  17.   for c = 1,8 do
  18.   turtle.select(c)
  19.   turtle.drop()
  20.   end
  21.   turnaround()
  22. turtle.select(1)
  23.   end
  24. end
  25.  
  26. function books()
  27.     if turtle.getItemCount(16) == 0 then
  28.     turtle.select(15)
  29.     turtle.transferTo(16,1)
  30.     end
  31. end
  32.  
  33.  
  34. function dropEnchant()
  35. turnaround()
  36. turtle.select(16)
  37. turtle.drop()
  38. turnaround()
  39. end
  40.  
  41. function enchant()
  42. level = m.getLevels()
  43. if level >=30 then
  44.     turtle.select(16)
  45.     m.enchant(30)
  46.     turtle.select(1)
  47.     term.clear()
  48.     dropEnchant()
  49. end
  50. end
  51.  
  52. --Main
  53.  
  54. while true do
  55.  
  56. term.setCursorPos(1,1)
  57. print(m.getLevels())
  58. turtle.attack()
  59. turtle.suck()
  60. books()
  61. check()
  62. enchant()
  63. end
Advertisement
Add Comment
Please, Sign In to add comment