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

Looking for a mining program ..

Started by wowtilder, 29 January 2015 - 05:05 PM
wowtilder #1
Posted 29 January 2015 - 06:05 PM
I know there are a million mining programs in the Turtle Programs forum.. a lot seem to be branch mining programs, or something like that.. I'm looking for a program that will mine a node of ore to completion…

If one doesn't exist, I'll try to write one..

Having said that - is there a better UI for writing LUA than on the computer in the game? Any ol' LUA editor will do? I was hoping for one that "knew" about computercraft so that I could be lazy about method calls and such.

Thanks :)/>
HPWebcamAble #2
Posted 30 January 2015 - 02:30 AM
I'm looking for a program that will mine a node of ore to completion…

I'm sure a program exists somewhere, but I haven't seen one. You could try writing one

There IS the program that comes with Computer Craft

Type

excavate <diameter>
in a mining turtle and it will make a square hole to bedrock that is <diameter> by <diameter>

It will automatically use the coal it finds as fuel, but won't try to mine ore veins that leave the hole.


I thought it would be cool to make one that mines every 2 layers, to avoid excess cobble, and follows veins around it until they finish.
I haven't though, so if you would like to, go ahead :)/>

is there a better UI for writing LUA than on the computer in the game? Any ol' LUA editor will do? I was hoping for one that "knew" about computercraft so that I could be lazy about method calls and such.

If you are refering to something like Eclipse for Java, no there isn't anything THAT smart, but GravityScore's LuaIDE is close.
(Look in the rom folder on an Advanced Computer, it is included with CC)

For external programs, there's Notepad++, which is smarter about code formatting, but only highlights keywords for you. It can't check your code like Eclipse.
(Link to NP++ site: http://notepad-plus-plus.org/)
Edited on 30 January 2015 - 03:34 AM
KingofGamesYami #3
Posted 30 January 2015 - 03:36 AM
I know there are a million mining programs in the Turtle Programs forum.. a lot seem to be branch mining programs, or something like that.. I'm looking for a program that will mine a node of ore to completion…

If one doesn't exist, I'll try to write one..

Having said that - is there a better UI for writing LUA than on the computer in the game? Any ol' LUA editor will do? I was hoping for one that "knew" about computercraft so that I could be lazy about method calls and such.

Thanks :)/>/>

Mining - I made a mining program once. It's probably still around…

Anyway, I did a cool little bit of (proper) recursive ore mining. It's based on a function that calls itself.


local mForward, mLeft, mRight, mUp, mDown
mForward = function()
  if turtle.compare( 1 ) then
    turtle.dig()
    turtle.forward()
    return mLeft(), mRight(), mUp(), mDown(), turtle.back()
  end
  return mLeft(), mRight(), mUp(), mDown()
end
mLeft = function()
  turtle.turnLeft()
  if turtle.compare( 1 ) then
    turtle.dig()
    return mForward() turtle.turnRight()
  end
  turtle.turnRight()
end
--#etc.

PS: As for lua editor, I use sublime text 2 with the package someone posted. Too lazy to look it up, but the computercraft syntax is actually available.
Edited on 30 January 2015 - 02:37 AM
Bomb Bloke #4
Posted 30 January 2015 - 05:09 AM
(proper)

Erm, when you say that, is it because you think it won't trigger stack overflows? Because it'll totally trigger stack overflows.
Lyqyd #5
Posted 30 January 2015 - 07:15 AM
If the veins are small enough, it might not. It's definitely not the best way to design that sort of thing, though.
wowtilder #6
Posted 30 January 2015 - 03:47 PM
Awesome! Thanks for the suggestions, and the code! I'll give it a shot, and hopefully won't crash my computer, MC, or both ;-)

It hadn't occured to me to use Sublime Text and set the syntax to LUA - thank's for the suggestion.

I also discovered (though, I expect most of you already knew) that I can modify the CC program in the world/computer/(id)/ folder, and it's updated in the game basically instantly. I didn't know this, and it's made playing around with CC much easier…