Sprinricco

Untitled

Feb 3rd, 2013
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.64 KB | None | 0 0
  1. local function clear()
  2. term.clear()
  3. term.setCursorPos(1,1)
  4. end
  5.  
  6. local height = 0
  7. i = 4
  8.  
  9. local function otherTrees()
  10.  
  11. if turtle.detectUp() then
  12. turtle.digUp()
  13. end
  14. while turtle.detect() do
  15. turtle.dig()
  16. turtle.up()
  17. if turtle.detectUp() then
  18. turtle.digUp()
  19. end
  20. height = height + 1
  21. end
  22. end
  23.  
  24.  
  25.  
  26. local function jungleTree()
  27.  
  28. while placement == true do
  29. turtle.dig()
  30. turtle.forward()
  31. turtle.turnRight()
  32. turtle.dig()
  33. turtle.forward()
  34. turtle.turnRight()
  35. turtle.dig()
  36. turtle.forward()
  37. turtle.digUp()
  38. turtle.up()
  39. turtle.turnRight()
  40. height = height + 1
  41. if turtle.detectUp() then
  42. i = i
  43. else
  44. i = i - 1
  45. end
  46. if i == 0 then
  47. placement = false
  48. end
  49. end
  50.  
  51. end
  52. placement = false
  53.  
  54. clear()
  55.  
  56.  
  57. print( "Which kind of tree am I looking at? (type the number of the tree)" )
  58. print("1>Oak" )
  59. print("2>Birch" )
  60. print("3>Spruce" )
  61. print("4>Jungle" )
  62.  
  63. tree = io.read()
  64. tree = tonumber( tree )
  65. sleep(.3)
  66.  
  67. clear()
  68.  
  69. if tree == 4 then
  70. print("Felling a Jungle Tree")
  71. turtle.dig()
  72. turtle.forward()
  73. turtle.turnLeft()
  74. if turtle.detect() then
  75. placement = true
  76. else
  77. turtle.turnRight()
  78. placement = true
  79. end
  80.  
  81. while placement == true do
  82. jungleTree()
  83. if i == 0 then
  84. placement = false
  85. end
  86. end
  87.  
  88.  
  89. elseif tree == 1 or tree == 2 or tree == 3 then
  90. print("Lumberjack mode activated...")
  91. otherTrees()
  92. else
  93. print("Not a valid option")
  94. end
  95.  
  96. print( "Tree was "..height.." blocks tall" )
  97. while height > 0 do
  98. turtle.down()
  99. height = height - 1
  100. end
Add Comment
Please, Sign In to add comment