Posted 14 April 2013 - 05:46 AM
I've just made my first program in my mining turtle.I have a problem when tried to start , I can first enter my distance but then this pops up roedgud:12:Attempt to call nil I've tried to find my problem on the internet but it's hard to find it.
Here's the code
It's working now, thanks
Here's the code
local running = true
local distance = 1
print ("Distance:")
local maxdistance = read("*")
print("hello")
function diggo()
if turtle.forward() == false then
turtle.dig()
end
end
function left()
turtle.turnleft()
diggo()
turtle.forward()
end
function right()
turtle.turnright()
diggo()
turtle.forward()
end
function up ()
if turtle.up() == false then
turtle.digUp()
end
turtle.up()
diggo()
end
function down()
if turtle.down() == false then
turtle.digDown()
end
turtle.down()
diggo()
end
function mining()
diggo()
left()
turtle.turnright()
diggo()
up()
right()
turtle.turnleft()
diggo()
right()
turtle.turnleft()
diggo()
down()
left()
turn.left()
end
while running==true do
mining()
distance = distance+1
if distance > maxdistance then
running = false
end
end
edit: here are the error message "roedgud:12:Attempt to call nil"It's working now, thanks