Posted 22 September 2016 - 02:49 AM
Hello, folks. I would like to preface with the information that I am a complete beginner at ComputerCraft specifically and coding in general, and am learning through trial and error. I have watched tutorials on YouTube and read tutorials on the forum, but cannot locate the answer to my question. I am certain the answer is out there somewhere, but there is such a wealth of information that I am having difficulty locating the proverbial needle in a haystack. I hope someone here can help me. For references dimensions will be stated in a Width X Height X Length format.
I am programming a Crafty Miner Turtle to create shaft mining stations off of my Bedrock staircase. The idea is to plunk the turtle down on one of the steps on the desired level, run the program, then return later to the completed mining station. The intended design is for a 1 x 2 x 3 link tunnel to open into a chamber that is 5 x 3 x 5. One corner of the room, front left as you enter, is dug out one level lower into the wall creating a 2 x 1 x 2 hole for an endless water source.
I accomplished this last night with a simple (if somewhat lengthy) program that accomplished this goal by giving each command one at a time. The chamber took nearly 180 lines of code.
I am attempting to condense a program to utilize fewer lines of code by defining functions. My first snag hit immediately when defining the initial "digLink" function. I intend for the "digLink" function to result in the requisite 1x2x3 link tunnel carved into the wall. However when I run the program the turtle merely digs the block in front of it once then stops. I am sure I have an error somewhere, but I am not knowledgeable or experienced enough for it to be apparent to me. Can anyone assist me?
I am programming a Crafty Miner Turtle to create shaft mining stations off of my Bedrock staircase. The idea is to plunk the turtle down on one of the steps on the desired level, run the program, then return later to the completed mining station. The intended design is for a 1 x 2 x 3 link tunnel to open into a chamber that is 5 x 3 x 5. One corner of the room, front left as you enter, is dug out one level lower into the wall creating a 2 x 1 x 2 hole for an endless water source.
I accomplished this last night with a simple (if somewhat lengthy) program that accomplished this goal by giving each command one at a time. The chamber took nearly 180 lines of code.
I am attempting to condense a program to utilize fewer lines of code by defining functions. My first snag hit immediately when defining the initial "digLink" function. I intend for the "digLink" function to result in the requisite 1x2x3 link tunnel carved into the wall. However when I run the program the turtle merely digs the block in front of it once then stops. I am sure I have an error somewhere, but I am not knowledgeable or experienced enough for it to be apparent to me. Can anyone assist me?
function digLink()
LinkLength = 0
while LinkLength < 3 do
turtle.dig()
turtle.forward()
turtle.digUp()
LinkLength = LinkLength + 1
end
end
digLink()