Hello,
so I'm trying to make a mining program.
My mining program has a bug though and I cannot resolve it, I've rethought it like 20 times and still can't find the error.
http://pastebin.com/64cHCNw1
So what's wrong: my program works but It makes a staircase up instead of mining a straight line. Something is wrong in the function: the second while loop to be exact. It goes up someway though I have no clue why it should be going up.
Program Explanation
It's all about the function Mine()
the function starts off with a while loop for mining forward (to preven issues with gravel)
then we got another while loop to mine up (also to prevent gravel issues)
--> Basically Mine() mines out a 2x3 area. Then we have a for loop at the end to make the tunnel multiple blocks.
The function Light() places torches. It goes back and then forward to prevent the torch being placed on a block that's going to be mined a second later. It uses the 'j' variable to make sure it only places the torches every X blocks.
Thanks in advance
[Question] Mining Program Bug
Started by rpg4mc, Dec 27 2012 11:57 AM
4 replies to this topic
#1
Posted 27 December 2012 - 11:57 AM
#2
Posted 27 December 2012 - 12:03 PM
first of all, I think you are going 1 step to much forward because
anyways, your real problem lies here:
while turtle.forward() == false do turtle.dig() end turtle.forward()would go forward 2 times, 1 forced and 1 unforced.
anyways, your real problem lies here:
while turtle.up() == false do turtle.digUp() end turtle.digDown()notice that you are going up but you never command it to go down
#3
Posted 27 December 2012 - 12:07 PM
Doyle3694, on 27 December 2012 - 12:03 PM, said:
first of all, I think you are going 1 step to much forward because
anyways, your real problem lies here:

while turtle.forward() == false do turtle.dig() end turtle.forward()would go forward 2 times, 1 forced and 1 unforced.
anyways, your real problem lies here:
while turtle.up() == false do turtle.digUp() end turtle.digDown()notice that you are going up but you never command it to go down
ooh so when I put it in the argument of the while loop it will go up ? I thought I could just put that as a true or false but that it would never execute the 'turtle.up()'. I guess I need to put a 'turtle.down()' after the loop then ?
Thanks!
#4
Posted 27 December 2012 - 12:45 PM
Yes, you are saying "try to go up, and if you can't, dig above you until you have successfully gone up."
You are prob. looking for turtle.detect() and turtle.detectUp() which returns true if there is a block without id 0 above/infront of it, aka if a block above/infront of it is not air.
This ofcourse works for down as well, however, not for back.
You are prob. looking for turtle.detect() and turtle.detectUp() which returns true if there is a block without id 0 above/infront of it, aka if a block above/infront of it is not air.
This ofcourse works for down as well, however, not for back.
#5
Posted 27 December 2012 - 12:58 PM
Doyle3694, on 27 December 2012 - 12:45 PM, said:
Yes, you are saying "try to go up, and if you can't, dig above you until you have successfully gone up."
You are prob. looking for turtle.detect() and turtle.detectUp() which returns true if there is a block without id 0 above/infront of it, aka if a block above/infront of it is not air.
This ofcourse works for down as well, however, not for back.
You are prob. looking for turtle.detect() and turtle.detectUp() which returns true if there is a block without id 0 above/infront of it, aka if a block above/infront of it is not air.
This ofcourse works for down as well, however, not for back.
Thanks! I was finally able to finish my first program, I thank you for the info. Learned a lot
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users











