This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
KyStyle's profile picture

Mining part of the program not working

Started by KyStyle, 24 February 2017 - 09:27 PM
KyStyle #1
Posted 24 February 2017 - 10:27 PM
So I have recently been developing a turtle mining program.
It has a GUI, it detects gravel and places cobblestone beneath it if there is no block underneath it
you are supposed to be able to toggle the ability to place torches, set the mining distance, return back once finished and toggle the height of the tunnel to 2 or 3.

However, that last part isn't working.

It doesn't place torches, the tunnel height is working, but the turtle just keeps mining for as long as it has fuel.
I have spent hours trying to find the problem, and nothing I do is working.

If anyone can help me with this, that would be greatly appreciated.

My program is on GitHub Right now, you can get it from here:
https://github.com/MAK064/ComputerCraft-Library/blob/master/turtleminer

Thanks in advance!
Dog #2
Posted 24 February 2017 - 11:03 PM
I don't know if this will fix all your problems, but one thing I noticed is that you keep declaring placeTorches as local. You only need to localize when you first declare the variable and it will be localized to the scope it is within (for example an if statement) - so you should declare and localize placeTorches at the beginning of the script and the remove all the other 'local's from before placeTorches. That *might* be all that's need to fix the torch placing problem. I didn't review your script thoroughly, but I suspect that improper localization may be the source of your other problems as well.

surferpup made a tutorial on scope, code blocks, and structures you might wish to read.
Edited on 24 February 2017 - 10:04 PM
KyStyle #3
Posted 08 March 2017 - 07:07 AM
Ooh. That makes sense now, I'll give that a try.
Thanks Dog! :D/>