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

[DDT] Dig Dig Turtle

Started by Popeye, 15 April 2013 - 01:56 AM
Popeye #1
Posted 15 April 2013 - 03:56 AM
Hello Everyone,

Here is a little Program that will Dig out 1 by 21 Area of Dirt, Gravel or Sand.

[EDIT] New Download:
pastebin get pznvy7n2 Dig

UPDATE: There is a New Version of DDT. The Pastebin Download has been Change
And there is a Setup Screenshot.

Setup:


To Install:

Go to your Search Bar, and type %appdata%.
It will bring to to your Roaming File. Click .minecraft.
Once you are in your .minecraft, Click on a File called Save's.
Click on your World File, click on a File called Computer.

If you have a Disk in your World click on the Disk File,
Then Drag the File I have attached to this Topic into a file called Disk

Also if there are any Bugs, Notify me Straight away!

Enjoy!
theoriginalbit #2
Posted 15 April 2013 - 04:06 AM
Why 1 x 21?
Why can't it be customisable?
Why no pastebin with this or your torch placer program? makes installing so much easier, and caters for all OSes, unlike your instructions there.
Lastly, why does the word 'Download' link to your other program?
Popeye #3
Posted 15 April 2013 - 06:07 AM
1: Yes it is Customisable. Just change
 for i = 1, Length do

2: I do not know how to make a 'Pastebin' for it.

3: I'm not sure.

And if I knew how to make a Pastebin for it… I would have.
cogilv25 #4
Posted 15 April 2013 - 02:12 PM
please use pastebin from now on as it is easier for people to download in game than use other services: you just goto pastebin.com paste your code and submit then copy the link and paste it here :)/> when he says customizable he means truly customizable as in it asks you how big you want it before it starts:

print("How long…?")
length = read()
print("How wide…?")
breadth = read()
–Dig Hole

p.s. you can't call a program customizable if you have to change code to do it as in that case all programs are "customizable"… technically your right but not if they don't know how :)/>
theoriginalbit #5
Posted 15 April 2013 - 02:27 PM
1: Yes it is Customisable. Just change
 for i = 1, Length do
Not what I meant, I am well aware that code can be changed, I was asking more to get you to think about it, and hopefully realise that not everyone knows how to program, and changing code can be quite hard or bad for them.

2: I do not know how to make a 'Pastebin' for it.
Go to http://pastebin.com get a copy of the text in your code and paste it into the box and hit 'Submit', then get the url and paste it here. Alternatively you can also do it from a computercraft computer with

pastebin put <filename>
where <filename> is the file you wish to put on pastebin, it will then upload it and give you a code, that code you would then put here in the thread. This code is what is used to download code from pastebin using the program like so

pastebin get <code> <filename>
where <code> is the code at the end of the pastebin url and <filename> is the file to save the code into.

says customizable he means truly customizable as in it asks you how big you want it before it starts:
print("How long…?")
length = read()
print("How wide…?")
breadth = read()
or even like the excavate program where you type in the values when you are running the program
Neekow #6
Posted 15 April 2013 - 02:37 PM
Really …
i'm not pro in lua, but i hope every one can do better than your thing …

your code:

print('Working!')
for i = 1,21 do
  turtle.refuel(1) -- Refueling the Turtle
  turtle.dig()
  turtle.forward()
  turtle.dig()
  turtle.forward()
end
turtle.turnRight()
turtle.turnRight()
turtle.forward()
turtle.forward()
turtle.forward()
turtle.forward()
turtle.forward()
turtle.forward()
turtle.forward()
turtle.forward()
turtle.forward()
turtle.forward()
turtle.forward()
turtle.forward()
turtle.forward()
turtle.forward()
turtle.forward()
turtle.forward()
turtle.forward()
turtle.forward()
turtle.forward()
turtle.forward()
turtle.forward()
turtle.forward()
turtle.forward()
turtle.forward()
turtle.forward()
turtle.forward()
turtle.forward()
turtle.forward()
turtle.turnLeft()
turtle.turnLeft()
print('Done')

With that, your turtle dig and go forward on 42 blocs then 2 times turn and come back 28 times!

You could, at least, do something like:


print("how long?")
length = read()
length = tonumber(length)  -- dunno if needed
fuelLvL = turtle.getFuelLevel()
--- functions ---
function Job()
for i= 1, length do
  turtle.dig()
  turtle.forward()
  turtle.digDown()
end
  turtle.turnLeft()
  turtle.turnLeft()
for i= 1, length do
  turtle.forward()
end
  turtle.turnLeft()
  turtle.turnLeft()
end

function Fuel()
if fuelLvL < 4* length then
  if turtle.refuel() == false then
	 print("Please, put fuel in slot 1")
  else
	 turtle.refuel(5)
	 Fuel()
  end
  else
  Job()
end
--- program ---
Fuel()
*May contains bugs, i didn't and wont test it, did it as an exemple

My little programs (done in 2 mins) does:
- ask the length
- auto refueling at start and test if the turtle have enought fuel for her job
- dig a 2 high tunnel so you can walk …
- easy to modify it (wanna add a torchs placer while digging? possible)
- come back at her initial place at the end.
Popeye #7
Posted 15 April 2013 - 08:57 PM
Well I'm not the best either.
Neekow #8
Posted 16 April 2013 - 02:09 AM
Take a look on how do a function, loops and a bit of maths ;)/>

functions are awesome if you have something to do many times
test fuel every time?:
action
fuel()
action
fuel()

loops are for repetitive actions as you did for the dig + forward
Popeye #9
Posted 16 April 2013 - 07:32 AM
There is now a Pastebin Download :)/>