Posted 19 January 2014 - 12:15 AM
Ok, I am having trouble with a mining turtle program I wrote. Code:
rednet.open("right")
redet.broadcast("Turtle Mine Program Started!")
local mine=true
print("How Long Will This Mine Be?")
length=read()
blockDis=0
blocksMined=0
estBlocks=6*length
print("Estimated Blocks Will Be Mined: "..estBlocks.."Blocks.")
print("Mining...")
while mine==true do
turtle.dig()
turtle.forward()
turtle.turnLeft()
turtle.dig()
turtle.forward()
turtle.digUp()
turtle.turnRight()
turtle.turnRight()
turtle.forward()
turtle.dig()
turtle.forward()
turtle.digUp()
turtle.turnLeft()
turtle.turnLeft()
turtle.forward()
turtle.turnRight()
blocksMined=blocksMined+6
rednet.broadcast("Turtle Mined "..blocksMined.." Blocks.")
rednet.broadcast("Turtle Has Gone "..blockDis.." Block Out Of "..length.." Blocks")
if blockDis==length then
mine=false
rednet.broadcast("Mining Complete!")
rednet.broadcast("Mined "..blocksMined.." Blocks Total!")
rednet.broadcast("Went "..blockDis.." "Blocks!")
end
end
My issue is that when it goes through the if statement "if blockDis==length then", it won't trigger when that should be true. I Don't Know Why It Isn't Triggering. Also, here is the code for the computer that gets the data of the broadcasting: rednet.open("top")
print("Waiting For Turtle Data...")
while true do
id, message = rednet.receive()
if id==7 then
print(message)
end
end