Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local invalid = true
- local width
- local height = 0
- repeat
- print( "How many blocks wide is the tree?" )
- width = tonumber(io.read())
- if width < 1 then
- print( "Tree width must be at least 1 block!" )
- invalid = true
- end
- if width > 2 then
- print( "Max width for Tree is 2 blocks" )
- invalid = true
- end
- if (width >=1) and (width <=2) then
- print( "Chopping " .. width .. " wide tree")
- invalid = false
- end
- until invalid == false
- if width == 1 then
- if turtle.detect() then
- turtle.dig()
- turtle.forward()
- end
- while turtle.detectUp() do
- turtle.digUp()
- turtle.up()
- height=height+1
- end
- for i=1,height do
- turtle.down()
- end
- end
- if width == 2 then
- if turtle.detect() then
- turtle.dig()
- turtle.forward()
- end
- while turtle.detect() do
- turtle.dig()
- turtle.turnRight()
- if turtle.detect() then
- turtle.dig()
- end
- turtle.turnLeft()
- if turtle.detectUp() then
- turtle.digUp()
- turtle.up()
- height=height+1
- end
- end
- turtle.forward()
- turtle.turnRight()
- if turtle.detect() then
- turtle.dig()
- end
- turtle.forward()
- turtle.turnLeft()
- for i=1,height do
- turtle.digDown()
- turtle.down()
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment