HoodedGame

Untitled

May 14th, 2016
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. --Getting the variables
  2. local tArgs = { ... }
  3. steps = tonumber(tArgs[1])
  4. torch = tArgs[2]
  5.  
  6. --Assigning defaults
  7. steps = steps or 1
  8. torch = torch or "t"[/size]
  9.  
  10. --Starting the dig
  11. for x = 1, steps
  12. if turtle.forward() == false then
  13. repeat
  14. turtle.dig()
  15. sleep(0.25)
  16. until turtle.forward() == true
  17. end
  18. end
  19.  
  20. --Getting into position for the return
  21. turtle.digUp()
  22. turtle.up()
  23. turtle.turnRight()
  24. turtle.turnRight()
  25.  
  26. --Changing the variable to allow for torches to be placed every 8
  27. steps = steps / 8
  28.  
  29. --Starting the return
  30. for x = 1, steps do
  31. if torch == "t" then
  32. turtle.turnLeft()
  33. turtle.dig()
  34. turtle.place()
  35. turtle.turnRight()
  36. end
  37.  
  38. for x = 1, 8 do
  39. if turtle.forward() == false then
  40. repeat
  41. turtle.dig()
  42. sleep(0.25)
  43. until turtle.forward() == true
  44. end
  45. end
  46. end
Add Comment
Please, Sign In to add comment