Posted 27 December 2012 - 01:28 AM
Hi everyone I have just started programming for Computercraft and I am trying to write an automated strip mine program. It is fairly basic so far (I plan to make it more complicated later) but I have a couple of questions regarding loops:
1. How to you put multiple conditions in for loops? In this for loop I have for the turtle returning when it is full (I has been counting up as it dug the tunnel). I want it to have 2 conditions, 1 being the counting up to I (so If there is no chest it will not mine for ever in the other direction) and another for checking whether the block in front of it is not a chest - turtle.compare(). How do I put both conditions in a single loop?
2. How do I reverse the boolean output of turtle.compare()
for num=0, I do
turtle.dig()
turtle.digDown()
turtle.forward()
end
Thank you for helping and sorry if the awsner is already out there. Looked through the tutorials and could not find it.
1. How to you put multiple conditions in for loops? In this for loop I have for the turtle returning when it is full (I has been counting up as it dug the tunnel). I want it to have 2 conditions, 1 being the counting up to I (so If there is no chest it will not mine for ever in the other direction) and another for checking whether the block in front of it is not a chest - turtle.compare(). How do I put both conditions in a single loop?
2. How do I reverse the boolean output of turtle.compare()
for num=0, I do
turtle.dig()
turtle.digDown()
turtle.forward()
end
Thank you for helping and sorry if the awsner is already out there. Looked through the tutorials and could not find it.