Posted 01 April 2013 - 07:22 AM
I end up having a LOT of mistakes in my code, and so half of the forum page isn't filled with my topics, I'm going to be posting my errors here and hope that someone comes to my rescue!
function checkfuel()
if turtle.getFuelLevel <= 10 then
turtle.select(1)
turtle.refuel()
end
end
function mineup()
repeat
turtle.digUp()
turtle.up()
until turtle.detectUp() == false
repeat
turtle.down()
until turtle.detectDown() == true
end
function ddf()
if turtle.detect() == true then
turtle.dig()
turtle.forward()
else
turtle.forward()
end
end
print("Hello. Welcome to the Cheesety210 Tree cutting program")
print("Please put your fuel in the first slot.")
turtle.turnRight()
turtle.turnRight()
turtle.turnRight()
turtle.turnRight()
term.clear()
print("I should be placed at the bottom of a tree next to it")
print("right next to the tree. A diagram is below.")
print(" [ ] = A log, and T is the turtle")
print("[ ] [ ] ")
print("[ ] [ ] ")
print(" T ")
print(" What is the width/length of the tree? In the example above it's 2.")
local length = read()
if length == 1 then
checkfuel()
ddf()
mineup()
end
if length == 2 then
checkfuel()
ddf()
mineup()
checkfuel()
ddf()
mineup()
checkfuel()
turtle.turnRight()
ddf()
mineup()
checkfuel()
turtle.turnRight()
ddf()
mineup()
checkfuel()
turtle.forward()
end
if length == 3 then
ddf()
mineup()
checkfuel()
ddf()
mineup()
checkfuel()
ddf()
mineup()
checkfuel()
turtle.turnRight()
ddf()
mineup()
checkfuel()
turtle.turnRight()
ddf()
mineup()
checkfuel()
ddf()
mineup()
checkfuel()
turtle.turnLeft()
ddf()
mineup()
checkfuel()
turtle.turnLeft()
ddf()
mineup()
checkfuel()
ddf()
mineup()
end
print("I am done with this tree!")
length = tonumber(read())
if turtle.getFuelLevel() <= 10 then