portablejim

Redwood chop

May 6th, 2013 (edited)
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.08 KB | None | 0 0
  1. -- Loosely based on http://pastebin.com/y8vXg8ew
  2.  
  3. function chop()
  4.     turtle.select(1)
  5.     -- Up one side
  6.     while turtle.compareUp() do
  7.         turtle.dig()
  8.         turtle.digUp()
  9.         turtle.up()
  10.     end
  11.     turtle.dig()
  12.  
  13.     -- Go to the other side
  14.     turtle.turnRight()
  15.     turtle.dig()
  16.     turtle.turnLeft()
  17.  
  18.     -- Down other side
  19.     turtle.dig()
  20.     turtle.digDown()
  21.     turtle.down()
  22.  
  23.     -- Check for more
  24.     turtle.turnLeft()
  25.     if turtle.compare() then
  26.         turtle.dig()
  27.         turtle.forward()
  28.         turtle.turnRight()
  29.         while turtle.compareUp() do
  30.             turtle.dig()
  31.             turtle.digUp()
  32.             turtle.up()
  33.         end
  34.         turtle.dig()
  35.         turtle.up()
  36.     end
  37. end
  38.  
  39. function orient()
  40.     turtle.turnLeft()
  41.     if not turtle.detect() then
  42.         turtle.turnRight()
  43.     end
  44. end
  45.  
  46. print("Welcome to Portablejim's")
  47. print("giant redwood cutting program")
  48. print(" ")
  49. print("Replace a redwood log with the turtle")
  50. print("and place the log in slot 1")
  51. print(" ")
  52. print("Hit enter when ready")
  53. read()
  54. chop()
Add Comment
Please, Sign In to add comment