Advertisement
gunny576

move

Nov 4th, 2013
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.62 KB | None | 0 0
  1. arg = {...}
  2. arg[2] = arg[2]+0
  3. d = 0
  4. d = arg[2]
  5. arg[1] = arg[1] +0
  6.  
  7. function forward ()
  8. for i=1, d , 1 do
  9. turtle.forward()
  10. end
  11. end
  12.  
  13. function back ()
  14. for i=1, d , 1 do
  15. turtle.back()
  16. end
  17. end
  18.  
  19. function left ()
  20. turtle.turnLeft()
  21. forward()
  22. end
  23.  
  24. function right ()
  25. turtle.turnRight()
  26. forward()
  27. end
  28.  
  29. function up ()
  30. for i=1, d , 1 do
  31. turtle.up()
  32. end
  33. end
  34.  
  35. function down ()
  36. for i=1, d , 1 do
  37. turtle.down()
  38. end
  39. end
  40.  
  41.  
  42. if arg[1]==1 then
  43. forward()
  44. end
  45. if arg[1]==3 then
  46. back()
  47. end
  48. if arg[1]==2 then
  49. left()
  50. end
  51. if arg[1]==4 then
  52. right()
  53. end
  54. if arg[1]==5 then
  55. up()
  56. end
  57. if arg[1]==6 then
  58. down()
  59. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement