Difference between revisions of "Advanced Turtle Lumberjack (tutorial)"
From ComputerCraft Wiki
DRUGMONSTER (Talk | contribs) (→The Code) |
(Fixed the loop so it actually works. Added forward movement after the first block is removed.) |
||
Line 6: | Line 6: | ||
=== What are Advanced Turtle Lumberjacks? === | === What are Advanced Turtle Lumberjacks? === | ||
− | Advanced Turtle Lumberjacks are basically [[Turtle_Lumberjack_(tutorial)|Turtle Lumberjacks]] that can dig blocks above them. | + | Advanced Turtle Lumberjacks are basically [[Turtle_Lumberjack_(tutorial)|Turtle Lumberjacks]] that can dig blocks above them. We first make the turtle dig the block in front of it and then move forward so the rest of the tree is directly above it. |
== The Code == | == The Code == | ||
<code> | <code> | ||
− | + | turtle.dig() | |
− | + | turtle.forward() | |
− | + | while turtle.detectUp() do | |
− | + | turtle.digUp() | |
− | + | ||
turtle.up() | turtle.up() | ||
end | end | ||
− | while | + | while not turtle.detectDown() do |
turtle.down() | turtle.down() | ||
end | end |
Revision as of 18:37, 20 March 2012
Contents
Advanced Turtle Lumberjack
Introduction
Welcome to this tutorial about Advanced Turtle Lumberjacks. See the Turtle Lumberjack Tutorial first.
What are Advanced Turtle Lumberjacks?
Advanced Turtle Lumberjacks are basically Turtle Lumberjacks that can dig blocks above them. We first make the turtle dig the block in front of it and then move forward so the rest of the tree is directly above it.
The Code
turtle.dig() turtle.forward() while turtle.detectUp() do turtle.digUp() turtle.up() end while not turtle.detectDown() do turtle.down() end
This makes us check if there are no blocks to be digged, then we go down until we can't. That's it!
(Helpful tip: Save this to your computercraft/lua/rom/programs folder, then it will be on all turtles.)
Category & Author
A tutorial by TheVarmari. Feel free to correct any mistakes!