Advertisement
Guest User

Untitled

a guest
Jul 21st, 2019
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. --placing torch with 5 spacec between by default
  2. --first argument is length of the tunel
  3. --second is optional, empty spaces between torches
  4.  
  5. local args = {...}
  6.  
  7. if args[1] == nil then
  8. print("Too little arguments.\n")
  9. return
  10. end
  11.  
  12. local distance = 0
  13.  
  14. if args[2] == nil then
  15. print("Default distance of 5.\n")
  16. distance = 6
  17. else
  18. print("Distance of "..args[2].." set.\n")
  19. distance = args[2] + 1
  20. end
  21.  
  22. local length = args[1]
  23.  
  24. turtle.select(1)
  25.  
  26. for i = 1, length do
  27.  
  28.  
  29. print("\t"..(i - 1).."%"..distance.."="..(i-1)%distance.."\n")
  30. if ((i - 1)%distance) == 0 then
  31. print("\t\tPlacing torch.\n")
  32. turtle.placeUp()
  33. end
  34. turtle.forward()
  35. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement