Posted 14 May 2015 - 02:42 AM
Basically I'm making a program that tells a turtle to dig out a specified area and height. The problem I am having is figuring out how to implement so the turtle returns to the starting point after finishing a layer? The way I want my program to work is so after the turtle finishes a layer, it returns to the spot it started and goes up 1 level and reruns.
The code I have so far is as followed
Auto slim farm
The code I have so far is as followed
Auto slim farm
function forward()
turtle.detect()
turtle.dig()
turtle.attack()
turtle.forward()
end
function turnRight()
turtle.turnRight()
turtle.detect()
turtle.dig()
turtle.attack()
turtle.forward()
turtle.turnRight()
end
function turnLeft()
turtle.turnLeft()
turtle.detect()
turtle.dig()
turtle.attack()
turtle.forward()
turtle.turnLeft()
end
function getInput()
print "Enter Rows : "
rows = read()
print "Enter Columns : "
columns = read()
print "Enter Height : "
height = read()
end
getInput()
while height < 4 do
for j = 0, columns do
for k = 0, rows do
forward()
end
if turtle % 2 == 0 or turtle % 2 == 2 then
turnRight()
end
else
turnLeft()
end
end
Edited on 15 May 2015 - 03:40 AM