Advertisement
hiphopcanine

Computercraft ClearArea Progam

Jan 26th, 2015
245
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.96 KB | None | 0 0
  1. function drop()
  2.    
  3.     for slot=1,9 do
  4.         turtle.select(slot)
  5.         turtle.drop()
  6.     end
  7.  
  8. end
  9.  
  10. function ClearUp()
  11.  
  12.     count=0
  13.    
  14.     while turtle.detectUp() do
  15.         turtle.digUp()
  16.         turtle.up()    
  17.         count = count+1
  18.     end
  19.    
  20.     for k=1,count do
  21.         turtle.down()
  22.     end
  23.  
  24. end
  25.  
  26. function ClearLine(depth)  
  27.  
  28.     for i=1,depth do
  29.         turtle.dig()
  30.         turtle.forward()
  31.         ClearUp()
  32.     end
  33. end
  34.  
  35. function ClearArea()
  36.  
  37.     for j=1,length/2 do
  38.         ClearLine(depth)
  39.         turtle.turnRight()
  40.         turtle.dig()
  41.         turtle.forward()
  42.         ClearUp()
  43.         turtle.turnRight()
  44.         ClearLine(depth)
  45.         turtle.turnLeft()
  46.         turtle.dig()
  47.         turtle.forward()
  48.         ClearUp()
  49.         turtle.turnLeft()
  50.         drop() 
  51.     end
  52. end
  53.  
  54. function Return()
  55.  
  56.     turtle.turnLeft()
  57.    
  58.     for l=1,length do
  59.         turtle.forward()
  60.     end
  61.  
  62.     turtle.turnRight()
  63.  
  64. end
  65.  
  66. print("How deep should I clear?")
  67. depth = read()
  68. print("How wide (right of here) should I clear?")
  69. length = read()
  70. slot = 1
  71. turtle.select(1)
  72.  
  73. ClearArea()
  74. Return()
  75. turtle.select(1)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement