default_1

Melee XP Turtle Auto-Enchanter

Aug 10th, 2013
429
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.24 KB | None | 0 0
  1. if not fs.exists("startup") then
  2.  fs.copy("disk/startup", "startup")
  3. end
  4. m = peripheral.wrap("right")
  5. m.setAutoCollect(true)
  6. while true do
  7.  turtle.attack()
  8.  local xp = m.getLevels()
  9.  local rawXP = m.getXP()
  10.  local kills = rawXP/5
  11.  term.clear()
  12.  term.setCursorPos(14,5)
  13.  print("Level: "..xp.."/30")
  14.  local x = 2
  15.  if xp <= 15 then
  16.   local nextLevel = 17 * (xp+1)
  17.   term.setCursorPos(9,6)
  18.   print("Current RawXP: "..rawXP.."/"..nextLevel)
  19.   term.setCursorPos(9,7)
  20.   print("Estimated Kills: "..kills)
  21.   repeat
  22.    turtle.select(x)
  23.    turtle.dropDown()
  24.    x = x + 1
  25.   until x == 16
  26.  elseif xp <= 29 then
  27.   local level = xp + 1
  28.   local nextLevel = 1.5 * level * level - 29.5 * level + 360
  29.   term.setCursorPos(9,6)
  30.   print("Current RawXP: "..rawXP.."/"..nextLevel)
  31.   term.setCursorPos(9,7)
  32.   print("Estimated Kills: "..kills)
  33.   repeat
  34.    turtle.select(x)
  35.    turtle.dropDown()
  36.    x = x + 1
  37.   until x == 16
  38.  elseif xp >= 30 then
  39.   turtle.select(1)
  40.   m.enchant(30)
  41.   local x = 1
  42.   repeat
  43.    local nonBook = turtle.getItemSpace(x)
  44.    turtle.select(x)
  45.    turtle.dropDown()
  46.    turtle.select(16)
  47.    local compare = turtle.compareTo(1)
  48.    if not compare then
  49.     turtle.transferTo(1,1)
  50.    end  
  51.    x = x + 1
  52.   until x == 16
  53.  end
  54. end
Advertisement
Add Comment
Please, Sign In to add comment