Advertisement
Guest User

mmp

a guest
Nov 26th, 2014
175
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.93 KB | None | 0 0
  1. local tArgs = { ... }
  2. if #tArgs ~= 3 then
  3.   print("Usage: mine <length> <width> <depth>")
  4.   return
  5. end
  6. local function move(x,y)
  7. shell.run("move",x,y)
  8. end
  9. local function status(x,y,z,depth,width,length)
  10. print("x="..x.." y="..y.." z="..z.." depth="..depth.." length="..length.." width="..width)
  11. end
  12.  
  13. local length = tArgs[1] - 1
  14. local width = tArgs[2]
  15. local depth = tArgs[3]
  16. local distance = tArgs[1] + tArgs[2] + tArgs[3]
  17. local x=0
  18. local y=0
  19. local z=0
  20.  
  21. for z=1,depth do
  22. for x=1,width do
  23. for y=1,length do
  24. status(x,y,z,depth,width,length)
  25. turtle.dig()
  26. move("f","1")
  27. sleep(.1)
  28. end
  29. status(x,y,z,length,width,depth)
  30. d=bit.band(x,1)
  31. if x == a then
  32. print("x=a")
  33. else
  34. if d==0 then
  35. print("x does not equal width")
  36. status(x,y,z,length,width,depth)
  37. move("l","0")
  38. turtle.dig()
  39. move("f","1")
  40. move("l","0")
  41. elseif d==1 then
  42. move("r","0")
  43. turtle.dig()
  44. move("f","1")
  45. move("r","0")
  46. else
  47. move("f","0")
  48. end
  49. end
  50. end
  51. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement