The first chunk just deals with its initial startup and communication. all that is tested and works.
i have gone over the code several times but im not sure whats wrong. If anyone could give it a look i would apreciate it.
Thanks for the help.
rednet.open("right")
rn = rednet.send
fx = turtle.getItemCount(16)
a = fx - 1
sleep(1)
rn (base , "Connection established")
sleep(1)
rn (base , "getting fuel level")
sleep(1)
turtle.getFuelLevel()
local f = turtle.getFuelLevel()
sleep(1)
rn (base , "Current fuel level is "..f.."" )
sleep(1)
if f < 100 then
turtle.getItemCount(16)
rn (base , "current coal stack is")
turtle.select(16)
turtle.refuel(a)
else
rn (base , "Fuel levels are acceptable")
sleep(1)
end
sleep(1)
rn (base , "getting coal count")
turtle.getItemCount(16)
sleep(1)
rn (base, "I have "..fx.." Coal")
sleep(1)
if fx < 64 then
rn (base, "DANGER! Coal is low")
os.reboot()
else
rn (base, "Coal storage is full")
sleep(2)
end
sleep(1)
rn (base , "comencing program")
--=======comence mining=======--
td = turtle.dig
tm = turtle.move
tc = turtle.detect
--===========fuel=============--
turtle.getFuelLevel()
if f < z + 10 then
rn (base , "Danger! fuel levels low.")
turtle.select(16)
turtle.refuel(a)
turtle.getFuelLevel()
if f < z + 10 then
rn (base , "Insuficient Coal, Returning.")
home()
else
end
else
end
--=======return code==========--
function home()
tcUp(z + 2)
rn (base , "Mining Operation finished")
os.shutdown()
end
--============value===========--
function value()
if turtle.detect() == false
then return false
end
for i = 1,3 do
turtle.select(i)
if turtle.compare() then
return false
else
return true
end
end
--============walls===========--
function walls()
for j = 1,4 do
if value() then
td()
rn (base, "ORE!")
else
turtle.turn("right")
end
end
--=============home===========--
function home()
tmUp(z)
rn (base , "Done, ready for pickup")
os.shutdown
--===========Dig Code=========--
function mine()
fuel()
tcDown()
if true then
tdDown()
tcDown()
if true then
rn (base , "I hit bedrock, Returning")
home()
else
tmDown()
walls()
z = z + 1
else
tmDown()
walls()
z = z + 1
end
end
--===========start=========--
while true do
mine()
end