nomnuggetnom

Book Combiner

Sep 1st, 2013
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.87 KB | None | 0 0
  1. local anvil = peripheral.wrap("right")
  2. local xpTable = peripheral.wrap("left")
  3. xpTable.setAutoCollect(true)
  4.  
  5. function combineItems(slotOne, slotTwo)
  6.     if xpTable.getLevels() >= anvil.getRepairCost(slotOne, slotTwo) then
  7.         turtle.select(1)
  8.         if turtle.compareTo(2) then
  9.             if anvil.repair(slotOne, slotTwo) then
  10.                 print("Repaired, dropping.")
  11.                 turtle.select(slotOne)
  12.                 turtle.drop()
  13.             else
  14.                 print("Can't repair that.")
  15.                 turtle.select(slotOne)
  16.                 turtle.drop()
  17.                 turtle.select(slotTwo)
  18.                 turtle.drop()
  19.             end
  20.         else
  21.             print("Not the same.")
  22.             turtle.select(1)
  23.             turtle.drop()
  24.             turtle.select(2)
  25.             turtle.drop()
  26.         end
  27.     else   
  28.         sleep(1)
  29.     end
  30. end
  31.  
  32. -------------
  33. while true do
  34. -------------
  35.  
  36. for i = 1,2 do
  37.     if turtle.getItemCount(i) == 0 then
  38.         turtle.select(i)
  39.         turtle.suckUp()
  40.     end
  41. end
  42.  
  43. combineItems(1,2)
  44. sleep(.5)
  45.  
  46. ---
  47. end
  48. ---
Advertisement
Add Comment
Please, Sign In to add comment