Posted 02 May 2012 - 02:45 PM
Hey guys i've come accross this great mod 2 days ago and written a litte programm:
what i want: put turtle down somewhere and dig - for example - 100x100x1 area return to start and if "morefloors" is on repeat this for the number of floors.
in general this is working great so far. i need this to get rid of some land and tree's and stuff in the air. i'm clearing a laaaarrggee area for my new homebase from
sky to badrock and it's a pain to remove all the dirt and wood/leaves) in a jungle biome :)/>/> therefore i thought this turtle's could do that.
now the problem: if i start the miner it works for a time but when i go afk (takes long time) the turtle messes up. sometimes i coudn't even find them again.
when i'm testing with like 4x4x4 area's it works great but larger scale seems to have problems.
i would love to get some response and tips to make my code better.
greetings,
nova
local tArgs = { ... }
steps = tonumber(tArgs[1])
if tArgs[2] ~= nil then
floors = tonumber(tArgs[2])
floors2 = floors-1
morefloors = true
end
turns = steps/2
steps2 = steps-1
durchlauf = 1
if turns == math.floor(turns) then
turns = math.floor(turns)
else
print("Die Zahl muss durch 2 teilbar sein!")
exit()
end
function digging()
for n=1, steps2 do
while turtle.detect() do
turtle.dig()
end
turtle.forward()
end
turtle.turnLeft()
while turtle.detect() do
turtle.dig()
end
turtle.forward()
turtle.turnLeft()
for m=1,steps2 do
while turtle.detect() do
turtle.dig()
end
turtle.forward()
end
if durchlauf == turns then
sleep(0.25)
turtle.turnLeft()
for k=1, steps2 do
while turtle.detect() do
turtle.dig()
end
turtle.forward()
end
turtle.turnLeft()
else
turtle.turnRight()
while turtle.detect() do
turtle.dig()
end
turtle.forward()
turtle.turnRight()
end
durchlauf = durchlauf+1
end
if morefloors == true then
for d=1, floors do
durchlauf = 1
for x=1,turns do
digging()
end
if d == floors then
for z=1,floors2 do
turtle.down()
sleep(0.25)
end
exit()
else
turtle.digUp()
sleep(0.25)
turtle.up()
end
end
else
for x=1,turns do
digging()
end
end
what i want: put turtle down somewhere and dig - for example - 100x100x1 area return to start and if "morefloors" is on repeat this for the number of floors.
in general this is working great so far. i need this to get rid of some land and tree's and stuff in the air. i'm clearing a laaaarrggee area for my new homebase from
sky to badrock and it's a pain to remove all the dirt and wood/leaves) in a jungle biome :)/>/> therefore i thought this turtle's could do that.
now the problem: if i start the miner it works for a time but when i go afk (takes long time) the turtle messes up. sometimes i coudn't even find them again.
when i'm testing with like 4x4x4 area's it works great but larger scale seems to have problems.
i would love to get some response and tips to make my code better.
greetings,
nova