jhughey99

ComputerCraft EZM v1.1

Oct 1st, 2022
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.61 KB | None | 0 0
  1. print("Place EnderStorageChest In Slot 16")
  2.  
  3. while turtle.getItemCount(16) == 0 do
  4. end
  5.  
  6.  
  7. write("Forward:")
  8.  
  9. local f = tonumber(read())
  10.  
  11.  
  12. write("Right:")
  13.  
  14. local r = tonumber(read())
  15.  
  16.  
  17. write("Up:")
  18.  
  19. local u = tonumber(read())
  20.  
  21. function dig()
  22.     while turtle.detect() == true do
  23.         turtle.dig()
  24.     end
  25. end
  26.  
  27. function digUp()
  28.     while turtle.detectUp() == true do
  29.         turtle.digUp()
  30.     end
  31. end
  32.        
  33.  
  34. function forward()
  35.     local keepGoing = true
  36.     while keepGoing do
  37.         if turtle.forward() then
  38.             keepGoing = false
  39.         end
  40.     end
  41. end
  42.  
  43. function up()
  44.     local keepGoing = true
  45.     while keepGoing do
  46.         if turtle.up() then
  47.             keepGoing = false
  48.         end
  49.     end
  50. end
  51.  
  52. function down()
  53.     local keepGoing = true
  54.     while keepGoing do
  55.         if turtle.down() then
  56.             keepGoing = false
  57.         end
  58.     end
  59. end
  60.  
  61. function chest()
  62.     turtle.select(15)
  63.     if turtle.getItemCount(15) > 0 then
  64.         turtle.select(16)
  65.         while turtle.place() == false do
  66.         end
  67.         for i = 1, 15 do
  68.             turtle.select(i)
  69.             turtle.drop()
  70.         end
  71.         turtle.select(1)
  72.         dig()
  73.         turtle.transferTo(16)
  74.     end
  75.     turtle.select(1)
  76. end
  77.  
  78. function chestUp()
  79.     turtle.select(15)
  80.     if turtle.getItemCount(15) > 0 then
  81.         turtle.select(16)
  82.         while turtle.placeUp() == false do
  83.         end
  84.         for i = 1, 15 do
  85.             turtle.select(i)
  86.             turtle.dropUp()
  87.         end
  88.         turtle.select(1)
  89.         digUp()
  90.         turtle.transferTo(16)
  91.     end
  92.     turtle.select(1)
  93. end
  94.  
  95. turtle.select(1)
  96.  
  97. for i = 1, u do
  98.     for j = 1, r do
  99.             for k = 1, f-1 do
  100.                 dig()
  101.                 chest()
  102.                 forward()
  103.             end
  104.             if j ~= r then
  105.                 if j%2 ~= 0 then
  106.                     turtle.turnRight()
  107.                     dig()
  108.                     chest()
  109.                     forward()
  110.                     turtle.turnRight()
  111.                 end
  112.                 if j%2 == 0 then
  113.                     turtle.turnLeft()
  114.                     dig()
  115.                     chest()
  116.                     forward()
  117.                     turtle.turnLeft()
  118.                 end
  119.             end
  120.     end
  121.  
  122.     if r%2 == 0 then
  123.         turtle.turnRight()
  124.         for b = 1, r-1 do
  125.             forward()
  126.         end
  127.         turtle.turnRight()
  128.     end
  129.  
  130.     if r%2 ~= 0 then
  131.         for b = 1, f-1 do
  132.             turtle.back()
  133.         end
  134.         turtle.turnLeft()
  135.         for b = 1, r-1 do
  136.             forward()
  137.         end
  138.         turtle.turnRight()
  139.     end
  140.  
  141.     if i ~= u then
  142.         digUp()
  143.         chestUp()
  144.         up()
  145.     end
  146. end
  147.  
  148. for d = 1, u-1 do
  149.     down()
  150. end
Add Comment
Please, Sign In to add comment