Posted 25 February 2012 - 07:46 PM
Hi, I am experimenting around with making a miner that will mine a square straight down, but I get some errors…
when my turtle runs it it gets an error after some time, would be nice if annyone could try it out and look at the error message.
DragonDonut
Error message:
parallel:22: -9
press any key to continue
thread: java.lang.TreadDeath
mine:75: -2
Code:
when my turtle runs it it gets an error after some time, would be nice if annyone could try it out and look at the error message.
DragonDonut
Error message:
parallel:22: -9
press any key to continue
thread: java.lang.TreadDeath
mine:75: -2
Code:
local length = 0
local side = 0
local depth = 0
local turns = 0
local thing = 0
function mine()
if not turtle.detect() and length == 0 then
turtle.digDown()
turtle.down()
elseif turtle.detect() and length == 0 then
end
end
function turn()
if length == 5 and side ~= 1 and thing == 0 then
turtle.turnLeft()
turtle.dig()
turtle.forward()
turtle.turnLeft()
length = 0
side = 1
turns = turns + 1
thing = 1
elseif length == 5 and side ~=0 and thing == 1 then
turtle.turnRight()
turtle.dig()
turtle.forward()
turtle.turnRight()
length = 0
side = 0
turns = turns +1
thing = 0
end
end
function mine2()
while length ~= 5 do
turtle.dig()
turtle.forward()
length = length + 1
end
end
function down()
if turns == 4 then
turtle.digDown()
turtle.down()
if side == 1 then
turtle.turnRight()
turtle.turnRight()
thing = 0
side = 1
elseif side == 0 then
turtle.turnLeft()
turtle.turnLeft()
thing = 1
side = 0
else
print("ERROR!!!")
end
turns = 0
depth = depth + 1
length = 0
end
end
while depth ~= 10 do
turn()
mine2()
down()
end