spartanboy56

exp right

Apr 1st, 2013
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.35 KB | None | 0 0
  1. function getLvl()
  2.     curLev = getLevels()
  3.     return curLev
  4. end
  5. function checkLevel(nLvl)
  6.     getLvl()
  7.     if curLev<nLvl then
  8.         printStatus("gathering XP", curLev)
  9.     else
  10.         printStatus("moving to enchant area", getLvl())
  11.         run()
  12.     end
  13.  
  14. end
  15.  
  16. function gotoenchant()
  17.     turtle.select(1)
  18.     turtle.down()
  19.     turtle.down()
  20.     turtle.down()
  21.     turtle.down()
  22.     turtle.turnLeft()
  23.         if not turtle.compareDown() then
  24.             turtle.forward()
  25.         else
  26.             turtle.turnRight()
  27.         end
  28.     forward()
  29.     end
  30. end
  31.  
  32. function forward()
  33.     for i = 1, 10 do
  34.         turtle.forward()
  35.     end
  36. end
  37.  
  38. function getItems()
  39.     for i=3,14 do
  40.         if turtle.getItemCount(i)>0 then
  41.                         turtle.select(i)
  42.                         turtle.transferTo(1,3)
  43.                         turtle.select(3)
  44.                         return true
  45.                 end
  46.         end
  47. --              print("no items found, trying to find books")
  48.         if findBook() then
  49.         --              print("Books found")
  50.                 return true
  51.         else
  52.                 return false
  53.         end
  54.  
  55. end
  56.  
  57. function findBook()
  58.         if turtle.getItemCount(15)>=1 then
  59.                 turtle.select(15)
  60.                 turtle.transferTo(1,3)
  61.                 turtle.select(3)
  62.                 return true
  63.         else
  64.                 return false
  65.         end
  66. end
  67.  
  68. function enchant()
  69.     enchant(30)
  70.     turtle.dropDown()
  71.     turtle.up()
  72. end
  73.  
  74. function backtomid()
  75.     for i = 1, 10 do
  76.         turtle.back()
  77.     end
  78.     turtle.down()
  79. end
  80.  
  81. function checkfuel()
  82.     if turtle.getFuelLevel()<500 then
  83.         getfuel()
  84.     end
  85. end
  86.  
  87. function getfuel()
  88.     turtle.up()
  89.     turtle.turnRight()
  90.     turtle.turnRight()
  91.     turtle.select(16)
  92.     turtle.suck(30)
  93.     turtle.refuel()
  94.     turtle.down()
  95.     turtle.turnRight()
  96.     turtle.turnRight()
  97. end
  98.  
  99. function checkbook()
  100.     if turtle.getItemCount(15)<4 then
  101.         getbook()
  102.     end
  103. end
  104.  
  105.  
  106. function getbook()
  107.     turtle.turnRight()
  108.     turtle.turnRight()
  109.     turtle.select(15)
  110.     turtle.suck(30)
  111.     turtle.turnRight()
  112.     turtle.turnRight()
  113. end
  114. function home()
  115.     turtle.select(2)
  116.     turtle.turnRight()
  117.     if not turtle.compareDown()
  118.         turtle.forward()
  119.     else
  120.         turtle.turnLeft()
  121.         turtle.up()
  122.         turtle.up()
  123.         turtle.up()
  124.         turtle.up()
  125.     end
  126. end
  127.  
  128. setAutoCollect(true)
  129. nLvl=30
  130.  
  131.  
  132. function run()
  133.     gotoenchant()
  134.     getItems()
  135.     enchant()
  136.     backtomid()
  137.     checkfuel()
  138.     checkbook()
  139.     home()
  140. end
  141.  
  142. while true do
  143.     checkLevel(nLvl)
  144. end
Advertisement
Add Comment
Please, Sign In to add comment