Advertisement
Guest User

dig

a guest
Dec 30th, 2012
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.16 KB | None | 0 0
  1. local tArgs = {...}
  2. local l = tArgs[1]
  3. local w = tArgs[2]
  4. local h = tArgs[3]
  5. local o = 0
  6. function mineRow(len)
  7.   for i = 1, len do
  8.     turtle.dig()
  9.     turtle.forward()
  10.   end
  11. end
  12. for i = 1, 3 do
  13.   if tArgs[i] == "0" then
  14.     print("Usage: ")
  15.     print("dig <length> <width> <height>")
  16.   end
  17. end
  18. print("Length: " .. l)
  19. print("Width: " .. w)
  20. print("Height: " .. h)
  21.  
  22. for i = 1, h do
  23.   for i = 1, w do
  24.     if o == 0 then
  25.       mineRow(l)
  26.       o = 1
  27.     elseif o == 2 then
  28.       turtle.turnRight()
  29.       turtle.forward()
  30.       turtle.turnRight()
  31.      
  32.       mineRow(l)
  33.       o = 2
  34.     elseif o == 1 then
  35.       turtle.turnLeft()
  36.       turtle.forward()
  37.       turtle.turnLeft()
  38.       mineRow(l)
  39.       o = 1
  40.     end
  41.     if o == 1 then
  42.       turtle.turnLeft()
  43.       for i = 1, w do
  44.         turtle.forward()
  45.       end
  46.       turtle.turnLeft()
  47.       for i = 1, l do
  48.         turtle.forward()
  49.       end
  50.       turtle.turnLeft()
  51.       turtle.turnLeft()
  52.       turtle.up()
  53.     elseif o == 2 then
  54.       turtle.turnRight()
  55.       for i = 1, w do
  56.         turtle.forward()
  57.       end
  58.       turtle.turnRight()
  59.       turtle.up()
  60.     end
  61.   end
  62. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement