Jump to content




Udig - Mining Turtle

turtle

5 replies to this topic

#1 unlimited

  • Members
  • 11 posts

Posted 04 September 2012 - 02:50 PM

Hi,

I've been trying to find a good quarry program for a while and yesterday i gave up and made one myself.

You can change the width, length and height.

pastebin:
code:
Spoiler

The turtle will dig until area is clear.

When full the turtle will return to start and drop all items on the block behind it, then go back to the spot and keep digging.

I use a transposer behind the turtle connected to a chest and the turtle will drop all items in the chest, i don't have 1.4 yet, so i don't have the fuel option and putting items directly into chests.

I'm not very good at lua, so please feel free to suggest any changes to the code.

enjoy =P


PS: anyone know how to save variables in a file or something so it keeps the coords after reboot?

#2 FrostVolkoff

  • New Members
  • 1 posts

Posted 05 September 2012 - 06:41 PM

Make a GPS tower :D/>

#3 dextermb

  • New Members
  • 34 posts

Posted 11 September 2012 - 12:12 PM

-- change mx for width, my for length and mz for height, the turtle will dig down and to the right
mx = 50
my = 50
mz = 10
-- Dont change anything bellow this line

x = 0
y = 0
z = 0
cx = 0
cy = 0
cz = 0

posy = 0
posx = 0

function f()
if turtle.forward() == false then
  repeat
  turtle.dig()
  sleep(0.25)
  until turtle.forward() == true
end
end

function d()
if turtle.down() == false then
  repeat
  turtle.digDown()
  sleep(0.25)
  until turtle.down() == true
end
end

function u()
if turtle.up() == false then
  repeat
  turtle.digUp()
  sleep(0.25)
  until turtle.up() == true
end
end

function check()
for i = 1,8 do
  if turtle.getItemCount(i) == 0 then
   return true
  end
end
end

function dropall()
for dropSlot = 1,9 do
  turtle.select(dropSlot)
  turtle.drop()
end
turtle.select(1)
turtle.turnRight()
turtle.turnRight()
end

function down()
while cz < mz do
  d()
  cz = cz+1
end
end

function up()
while cz > z do
  u()
  cz = cz-1
end
end

function bdig()
if cz == z and cx == x then
  goback()
  dropall()
else
  up()
  goback()
  dropall()
end
end

function goback()
posy = cy
posx = cx + 1
print("y - ",posy)
print("x - ",posx)
turtle.turnLeft()
while cx > x do
  f()
  cx = cx - 1
end
turtle.turnLeft()
while cy > y do
  f()
  cy = cy - 1
end
end

function udig()
while check() and cy < my do
  turtle.digUp()
  down()
  up()
  f()
  cy = cy+1
end
bdig()
end

while true do
if posx == x then
  while cy < posy do
   f()
   cy = cy + 1
  end
  udig()
elseif posx < mx and posy == my then
  turtle.turnRight()
  while cx < posx do
   f()
   cx = cx + 1
  end
  turtle.turnLeft()
  udig()
elseif posx < mx and posy ~= my then
  turtle.turnRight()
  while cx < posx - 1 do
   f()
   cx = cx + 1
  end
  turtle.turnLeft()
  while cy < posy do
   f()
   cy = cy + 1
  end
  udig()
elseif posy == my and posx == mx then
  print("Complete")
  break
end
end


#4 unlimited

  • Members
  • 11 posts

Posted 11 September 2012 - 02:04 PM

did you change anything?
i actually don't use this anymore i remade it so it could refuel and save pos on files so it doesn't reset on reboot

#5 yyttuuyy

  • New Members
  • 1 posts

Posted 17 September 2012 - 10:12 PM

i tried to get the program (tekkit version) with the http command but I keep geting lua:27: [string "lua"] :1: '<name.' expected
any ideas on what's happening and or how to fix it

#6 RayceFarelle

  • New Members
  • 4 posts

Posted 13 November 2012 - 12:27 AM

Nice and simple program you've made here. Although if there are any improvements you should make, it would be the ability to identify the bedrock. Thanks again for the program and keep up the good work.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users