Advanced Turtle Lumberjack (tutorial)

From ComputerCraft Wiki
Revision as of 18:37, 20 March 2012 by PTS (Talk | contribs) (Fixed the loop so it actually works. Added forward movement after the first block is removed.)

Jump to: navigation, search

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!