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

Turtle dig to bedrock and fill with cobblestone.

Started by Kazu, 15 July 2014 - 07:16 PM
Kazu #1
Posted 15 July 2014 - 09:16 PM
Hey guys,

I've seen a similar programm used by Sevadus.
Basically the turtle will dig down to the level of bedrock and fills the whole way up with cobblestone.
This way all holes, water and lava pockets will be closed.

Is there a code like this? I tried to find one via Google but I found nothing.

Kind regards,
Kazu
Edited on 15 July 2014 - 07:22 PM
Cranium #2
Posted 15 July 2014 - 09:22 PM

local height = 0
while turtle.digDown() do
    turtle.down()
    height = height - 1
end
repeat
    turtle.up()
    for i = 1,16 do
	    if turtle.getItemCount(i) > 0 then
		    turtle.select(i)
		    turtle.placeDown()
		    break
	    end
    end
    height = height + 1
until height == 0
Kazu #3
Posted 15 July 2014 - 09:36 PM
Thanks for the effort, but this doesnt quite work. The turtle only breaks the block beneath it replaces it with cobblestone.
Lyqyd #4
Posted 15 July 2014 - 09:37 PM
Did you fuel the turtle?
Kazu #5
Posted 15 July 2014 - 09:38 PM
Did you fuel the turtle?

Oh, you're right. The last time I really worked with turtles they didn't need fuel :D/>
Always forget this xD

~EDIT~
What would I need to do in order to make the turtle repeat this X times and always go one forward?
I never really used lua :D/>
Edited on 15 July 2014 - 07:47 PM
Bomb Bloke #6
Posted 16 July 2014 - 03:26 AM
It'd require a re-write to prevent it from filling in the previous column as it dug out the next one.

You may be better off providing the full specifics of your end goal. Are you thinking along the lines of the default "excavate" script, but with gap-filling?
Kazu #7
Posted 16 July 2014 - 10:02 PM
Sort of. I want to the turtle to dig down and fill everything with e.g. cobblestone.
If it's back to the start layer he should then go one forward and do the same again X times.

Where X is how many times he will do that.
hilburn #8
Posted 16 July 2014 - 10:29 PM
basically sticking the following around cranium's script will do that, but you'll need an external source of cobblestone


for j=1,X do
<Craniums code>
turtle.forward()
end
Edited on 16 July 2014 - 08:29 PM
Kazu #9
Posted 17 July 2014 - 06:15 AM
Thanks hilburn, I'll try tht later :3

~EDIT~

I tried a little bit with lua :)/>
local startHeight = 0
local itemFill = turtle.getItemCount(1)
local itemFuel = turtle.getItemCount(2)
local distance = 0
local Fuel = 0
local needFuel = 0

function Check()
if itemFill == 0 then
print("There are no blocks to fill with")
Error = 1
else
print("There are blocks to fill with")
end
if itemFuel == 0 then
print("There is no fuel available")
Error = 1
else
print("There is fuel available")
end
checkFuelLevel()
end

function reCheck()
  itemFill = turtle.getItemCount(1)
  itemFuel = turtle.getItemCount(2)
  Error = 0
end

function checkFuelLevel()
repeat
if turtle.getFuelLevel() == "unlimited" then
print("No need for fuel")
needFuel = 0
elseif turtle.getFuelLevel() < 100 then
turtle.select(2)
turtle.refuel(1)
needFuel = 1
itemFuel = itemFuel - 1
elseif needFuel == 1 then
needFuel = 0
end
until needFuel == 0
end

function fillHoles()
for j=1,distance do
while turtle.digDown() do
turtle.down()
startHeight = startHeight - 1
end
repeat
turtle.up()
for i = 1,16 do
if itemFill > 0 then
turtle.select(i)
turtle.placeDown()
break
end
end
startHeight = startHeight + 1
until startHeight == 0
turtle.forward()
checkFuelLevel()
end
end

print("Please place blocks to fill with in slot 1.")
print("Please place fuel in slot 2.")
print("How far will the Turtle go?")
input = io.read()
distance = tonumber(input)
Check()
if Error == 1 then
repeat
sleep(10)
reCheck()
Check()
until Error == 0
end
fillHoles()

Will this work?

For some reasons the code won't show properly xD
Edited on 17 July 2014 - 01:58 PM