Posted 25 February 2012 - 06:40 PM
Hi, I am testing around a little with the turtle and get a nil error when i try to call a function
thx for the help DragonDonut
Code:
local num1 = 0
local num2 = 0
mine()
local function mine()
if not turtle.detect() then
turtle.digDown()
turtle.down()
while num1 ~= 5 do
turtle.dig()
turtle.forward()
num1 = num1 + 1
end
if num1 == 5 and num2 ~= 1 then
turtle.turnLeft()
turtle.dig()
turtle.forward()
turtle.turnLeft()
num1 = 0
num2 = 1
elseif num1 == 5 and num2~=0 then
turtle.turnRight()
turtle.dig()
turtle.forward()
turtle.turnRight()
num1 = 0
num2 = 0
end
end
end
thx for the help DragonDonut
Code:
local num1 = 0
local num2 = 0
mine()
local function mine()
if not turtle.detect() then
turtle.digDown()
turtle.down()
while num1 ~= 5 do
turtle.dig()
turtle.forward()
num1 = num1 + 1
end
if num1 == 5 and num2 ~= 1 then
turtle.turnLeft()
turtle.dig()
turtle.forward()
turtle.turnLeft()
num1 = 0
num2 = 1
elseif num1 == 5 and num2~=0 then
turtle.turnRight()
turtle.dig()
turtle.forward()
turtle.turnRight()
num1 = 0
num2 = 0
end
end
end