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

[LUA] [ERROR] top-notch advanced lumberjack

Started by zunon, 01 April 2012 - 07:21 AM
zunon #1
Posted 01 April 2012 - 09:21 AM
hey guys i've been trying to create a top-notch advanced lumberjack to cut down jungle trees using two turtles but for some weird reason on most of the trees it sleeps in the leaves on the top

can some pro help?

heres the code


turtle.dig()
turtle.forward()
while turtle.detectUp() and not turtle.detect() do
   turtle.digUp()
   turtle.up()
end
while turtle.detectUp() and turtle.detect() do
   turtle.digUp()
   turtle.up()
end
while turtle.detect() and not turtle.detectUp() do
turtle.dig()
turtle.forward()
end
while turtle.detectUp() and turtle.detect() do
   turtle.digUp()
   turtle.up()
end
while turtle.detectUp() and not turtle.detect() do
   turtle.digUp()
   turtle.up()
end

while not turtle.detectDown() and not turtle.detect() and not turtle.detectUp() do
   turtle.down()
end

while turtle.detectDown() and not turtle.detect() and not turtle.detectUp() do
turtle.digDown()
turtle.down()
end
while not turtle.detectDown() and not turtle.detect() and not turtle.detectUp() do
   turtle.down()
end
repeat until not turtle.detect() and turtle.detectDown() and not turtle.detectUp()
zunon #2
Posted 01 April 2012 - 11:09 AM
bump!

please someone help
Advert #3
Posted 01 April 2012 - 05:13 PM
Please don't bump your topic three hours after no one has replied.

People help with stuff they know; if you do not get any replies, then most likely everyone that has read it don't know what the problem is, or are busy/lazy.

I haven't had time to test your code, but I can see that you aren't using the repeat statement corectly.
Correct usage is:


repeat
 <block>
until <condition>
In your case, I think you mean to encapsulate all the code above the repeat statement in it.