Clem105

Melee Enchanting turtle

Sep 7th, 2013
144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.38 KB | None | 0 0
  1. local xp = peripheral.wrap("right")
  2. local modem = peripheral.wrap("back")
  3. local Attaque = true
  4. local AutoCollect = false
  5. local livre = 0
  6. local slot = 1
  7. local level = 0
  8. local Count = 0
  9. function Attack()
  10.     while Attaque == true then
  11.         turtle.attack()
  12.     end
  13. end
  14. xp.setAutoCollect(true)
  15. function Clear()
  16.     term.clear()
  17.     term.setCursorPos(1,1)
  18. end
  19. while true do
  20.     level = xp.getLevels()
  21.     turtle.attack()
  22.     Count = Count+1
  23.     if turtle.getItemCount(14) > 0 then
  24.         for i=1,14 do
  25.             turtle.select(slot)
  26.             turtle.dropDown()
  27.             slot = slot+1
  28.         end
  29.         slot = 1
  30.         turtle.select(1)
  31.     elseif Count >= 10 then
  32.         Clear()
  33.         term.write("Niveau :" ..level)
  34.         Count = 0
  35.     elseif level >= 30 then
  36.         Clear()
  37.         term.write("Demande Comfirmation !")
  38.         while true do
  39.             local event, side, Xpos, Ypos = os.pullEvent("monitor_touch")
  40.             if event == "monitor_touch" and side == "top" then
  41.                 Clear()
  42.                 term.write("Enchantement en cours")
  43.                 turtle.select(15)
  44.                 turtle.transferTo(16,1)
  45.                 livre = turtle.getItemCount(15)
  46.                 if livre == 0 then
  47.                     turtle.turnRight()
  48.                     turtle.suck()
  49.                     turtle.turnLeft()
  50.                     livre = turtle.getItemCount(15)
  51.                 end
  52.                 term.write("Livres :"..livre)
  53.                 turtle.select(16)
  54.                 xp.enchant(30)
  55.                 turtle.dropDown()
  56.                 turtle.select(1)
  57.                 os.reboot()
  58.             else
  59.                 sleep(0,5)
  60.                 print("nothing")
  61.             end
  62.         end
  63.     else
  64.        
  65.         print(" ")
  66.     end
  67. end
Advertisement
Add Comment
Please, Sign In to add comment