6 posts
Posted 13 April 2012 - 01:19 PM
Ok, so I have a simple mining program I use in loops, but it gets stuck when encountering gravel. I would like to make it able to go through gravel without prematurely ending.
turtle.dig()
turtle.forward()
turtle.digUp()
378 posts
Location
In the TARDIS
Posted 13 April 2012 - 01:43 PM
I would try it like this:
Dig
Wait a short time
if turtle.detect() then
turtle.dig()
else
turtle.forward()
end
and run that code again
80 posts
Posted 13 April 2012 - 04:54 PM
Try:
while not turtle.forward() do
turtle.dig()
end
1111 posts
Location
Portland OR
Posted 13 April 2012 - 09:18 PM
You do something like this too which will wait until the path is clear
if turtle.forward() == false then
repeat
turtle.dig()
sleep(0.25) -- small sleep to allow for gravel/sand to fall.
until turtle.forward() == true
end
This will also help if a mob/player steps in front of the turtle as well.
Edited on 13 April 2012 - 07:20 PM
6 posts
Posted 14 April 2012 - 01:31 AM
Thanks, all.