This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
TheEvilSocks's profile picture

Lumberjack

Started by TheEvilSocks, 21 March 2012 - 04:30 PM
TheEvilSocks #1
Posted 21 March 2012 - 05:30 PM
Hello!

This is simply a program that let the turtle chop down trees.

Video:
[media]http://www.youtube.com/watch?v=MunEMh9WYxw[/media]

Code:


while turtle.detect() do
print("Chopping")
turtle.dig()
turtle.digUp()
print("Moving")
turtle.up()
end

while not turtle.detect() and not turtle.detectDown() do
print("Moving down")
turtle.down()
end
print("Job done!")

or

Download:

http://www.mediafire...wu87tgf20hc4mq2
SquareMan #2
Posted 25 March 2012 - 04:28 PM
Nice, short and simple but gets the job done.
Valtina #3
Posted 29 March 2012 - 05:08 PM
I been using a similar program, my only downside with this program is that it dosn't seems to be able to use bonemeal on the sapling that i place after the cutdown, anyone got a suggestion for that?
craton #4
Posted 15 June 2012 - 03:31 AM
i dont think that turtles can use bonemeal because if you are useing the place command then it reqiers the block in front of it to be clear but if it were clear bonemeal wouldent work. so because of that i dont think it will ever work. Sorry. :(/>/>
it dosn't seems to be able to use bonemeal on the sapling that i place after the cutdown, anyone got a suggestion for that?
Mtdj2 #5
Posted 15 June 2012 - 11:15 PM
I have seen a tutorial for pretty much that program on ComputerCraft Wiki… You have also made a mistake: For every single block it moves down, it prints: Job done!
Else: Pretty cool :(/>/>
craton #6
Posted 16 June 2012 - 04:04 AM
i hope you dont mind by i took this program and edited it so that it plants a sapling and waits for it to grow. it can go infanetly. Also fixed the job done thing.

function tree()
while turtle.detect()do
print("Chopping")
turtle.dig()
turtle.digUp()
print("Moving")
turtle.up()
end
while not turtle.detect() and not turtle.detectDown() do
print("Moving down")
turtle.down()
if turtle.detectDown() then
print("Job done")
end
end
end
while true do
turtle.select(1)
turtle.place()
if turtle.compare() then

else
tree()
end
end
ComputerCraftFan11 #7
Posted 16 June 2012 - 06:44 AM
Here is a simple fix to make it say Job Done at the correct time.

Code:


while turtle.detect() do
print("Chopping")
turtle.dig()
turtle.digUp()
print("Moving")
turtle.up()
end

while not turtle.detect() and not turtle.detectDown() do
print("Moving down")
turtle.down()
end
print("Job done!") --Moved this after the end
ReconTurtle #8
Posted 28 July 2012 - 05:49 PM
This is perfect for what it needs to do. I wrote a code (basically exactly like this one, not many ways it can be done), but I added a variable [height] that adds to itself every time the while loop is executed. Then at the end, it can display how tall the tree was. Just a little addition.

First post, by the way, hello!
dextermb #9
Posted 07 September 2012 - 02:36 PM
I was wondering how do you make it skip 'turtle.digup()' or 'turtle.dig()' if there is nothing there as it comes up with nill?