obsidian777

branch

Aug 11th, 2013
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function digIt()
  2.   while turtle.detect() do
  3.     turtle.dig()
  4.     os.sleep(0.5)
  5.   end
  6.   turtle.forward()
  7.   while turtle.detectDown() or turtle.detectUp() do
  8.     turtle.digUp()
  9.     turtle.digDown()
  10.   end
  11. end
  12.  
  13. function placeTorch()
  14.   turtle.down()
  15.   turtle.back()
  16.   turtle.select(16)
  17.   turtle.placeUp()
  18.   turtle.forward()
  19.   turtle.up()
  20. end
  21.  
  22. local run = 0
  23. local j = 0
  24. local k = 0
  25.  
  26. term.write("Branch length: ")
  27. run = read()
  28.  
  29. for i = 1, run do
  30.   k = i - 1
  31.   j = k % 10
  32.   if j == 1 then
  33.     placeTorch()
  34.   end
  35.   digIt()
  36. end
  37.  
  38. turtle.down()
  39. turtle.turnRight()
  40. turtle.turnRight()
  41. turtle.select(16)
  42. turtle.placeUp()
  43.  
  44. for i = 1, run do
  45.   turtle.forward()
  46. end
Add Comment
Please, Sign In to add comment