Posted 10 January 2013 - 07:37 AM
Hello everyone,
I'm kinda new to lua and did not coded really much but i know the basics.
I was trying to write a mining program in a (what i think is) effective and easy way.
But after i was done with writing and bugfixing it is still not working.
The goal was to let it mine away a 10 x 10 or 100 x 100 area but insteed it only digs out 10 blocks in the front.
I really can't find the problem myself, i tried many things.
I hope someone can help me with this problem!
Greetings,
Mika811
I'm kinda new to lua and did not coded really much but i know the basics.
I was trying to write a mining program in a (what i think is) effective and easy way.
But after i was done with writing and bugfixing it is still not working.
The goal was to let it mine away a 10 x 10 or 100 x 100 area but insteed it only digs out 10 blocks in the front.
I really can't find the problem myself, i tried many things.
x = 0
y = 10
q = true
z = 10
p = y
function mine()
turtle.dig()
turtle.digUp()
turtle.forward()
end
function mineLeft()
turtle.dig()
turtle.forward()
turtle.turnLeft()
turtle.dig()
turtle.forward()
turtle.digUp()
turtle.turnLeft()
q = false
z = z - 1
y = p
end
function mineRight()
turtle.dig()
turtle.forward()
turtle.turnRight()
turtle.dig()
turtle.forward()
turtle.digUp()
turtle.turnRight()
q = true
z = z - 1
y = p
end
function compare()
select(2)
a = turtle.compare()
select(3)
b = turtle.compare()
select(4)
c = turtle.compare()
select(5)
d = turtle.compare()
select(6)
e = turtle.compare()
select(7)
f = turtle.compare()
select(8)
g = turtle.compare()
select(9)
h = turtle.compare()
select(10)
i = turtle.compare()
while a or b or c or d or e or f or g or h or i == true do
turtle.digDown()
turtle.down()
x = x + 1
o = false
end
end
function goBack()
turtle.dig()
turtle.forward()
turtle.dig()
turtle.forward()
turtle.dig()
turtle.forward()
while x > 0 do
turtle.digUp()
turtle.up()
x = x - 1
end
y = y - 3
o = true
end
function needFuel()
if turtle.getFuelLevel() < 2000 then
return true
else
return false
end
end
function refuel()
turtle.refuel(1)
end
function test()
if y == 0 and q == true then
mineLeft()
return true
else return true
end
if y == 0 and c == false then
mineRight()
return true
else return true
end
if 0 == 10 then
goBack()
end
end
while needFuel() do refuel()
end
while test() and y > 0 and z > 0 do
compare()
mine()
y = y - 1
end
I hope someone can help me with this problem!
Greetings,
Mika811