Posted 12 October 2012 - 08:01 PM
Okay so I'm creating a program to have a mining turtle mine out a 15x15 area this is the code I have:
Now my problem is that when I run this the turtle stops working after moving forward the first 15 spaces and turning right. So either I'm thinking that my loop that starts "while turnTimes > 0" isn't working or I can't call the function movement() multiple times. If anyone has a solution to this that'd be great. Thank you!
- Cardmime
function movement(length)
movement = 0
while movement < length do
turtle.digDown()
turtle.forward()
movement = movement + 1
end
end
while turtle.detectDown() do
move = 15
while move > 0 do
distance = move
turnTimes = 3
while turnTimes > 0 do
movement(distance)
turtle.turnRight()
turnTimes = turnTimes - 1
end
move = move - 1
end
end
Now my problem is that when I run this the turtle stops working after moving forward the first 15 spaces and turning right. So either I'm thinking that my loop that starts "while turnTimes > 0" isn't working or I can't call the function movement() multiple times. If anyone has a solution to this that'd be great. Thank you!
- Cardmime