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

Mining Turtle Straight Down Dig Function

Started by Pie, 15 November 2013 - 08:05 AM
Pie #1
Posted 15 November 2013 - 09:05 AM
M1mE1v77

Hello im seeking help from the pro's to encounter my little problem(s) i have, what i want it to do is dig straight down to the 7'th layer then go back up to it's start location, in this case the location i sent it to via coordinates, and then i would like for it to detect if there's something under it to mine if not then it should start on the next row and so on for lets say 5 times, but the problem is i cannot seem to get it to work.
i would also love for it to go back to my starting location ( the xCoords and such ) and drop off it's inventory into a chest and then go back to (xQuarry) position and resume mining this would happen after every row it have digging.

the coordinate system thanks to BCGSamuel from youtube is working perfectly.

any help is appriciated and if u could explain how/why u use the code u would.

Thanks!
Lyqyd #2
Posted 15 November 2013 - 02:37 PM
Split into new topic.
Bomb Bloke #3
Posted 15 November 2013 - 03:24 PM
… but the problem is i cannot seem to get it to work.
It's impossible to comment on that without knowing what DOES happen - and even then it'd be difficult to provide any assistance without seeing the code you're using to cause that effect.
Pie #4
Posted 16 November 2013 - 01:44 PM
… but the problem is i cannot seem to get it to work.
It's impossible to comment on that without knowing what DOES happen - and even then it'd be difficult to provide any assistance without seeing the code you're using to cause that effect.
Sorry if i didnt formulate my question well enough, but i would like to know how YOU would do it, and then take refrence and learn from that.
Bomb Bloke #5
Posted 16 November 2013 - 08:53 PM
Do what? You haven't specified which of these tasks are giving you trouble nor why, and I can only guess as to your current knowledge level when it comes to Lua (or programming in general).

I'm not sure you'll have much luck getting someone to write the whole program for you - if that's what you're after - but there's not enough info here to do even that.

If you are asking for a "whole program example", then I suggest taking a read through the source code for the "excavate" script available to your turtles by default. It's within the lua\rom\programs\turtle directory inside the ComputerCraft zip archive. There're also plenty of mining scripts in this section that might interest you.

Edit:

Perhaps some more specific questions. Do you understand:
  • Conditional statements ("if" and/or "while")?
  • Loops ("while" and/or "for")?
  • Functions (calling and/or defining them)?
  • Variables?
  • Tables (or arrays)?
Edited on 16 November 2013 - 07:57 PM