S3mpx

move

Dec 22nd, 2020 (edited)
160
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.38 KB | None | 0 0
  1. -- Turtle Programm --
  2. -- Category: Movement/Mining --
  3.  
  4. -- [INFORMATION] --
  5. local appName = "Move.lua"
  6. local appType = "Turtle"
  7. local category = "Movement/Mining"
  8. local version = "1.0"
  9. local author = "S3mpx"
  10. -- print info --
  11. print("["..appName.."]")
  12. print("Programm Type: "..appType)
  13. print("Category: "..category)
  14. print("Version: "..version)
  15. print("written by"..author)
  16.  
  17. -- [LOCALS] --
  18.  
  19. local x = ""
  20. local y = ""
  21.  
  22. -- [FUNKTIONS] --
  23.  
  24. -- go(x) --
  25. local function go(x)
  26.     for i=1, x do
  27.         turtle.dig()
  28.         turtle.forward()
  29.     end
  30. end
  31.  
  32. -- up(x) --
  33. local function up(x)
  34.     for i=1, x do
  35.         turtle.digUp()
  36.         turtle.up()
  37.     end
  38. end
  39.  
  40. -- down(x) --
  41. local function down(x)
  42.     for i=1, x do
  43.         turtle.digDown()
  44.         turtle.down()
  45.     end
  46. end
  47.  
  48. -- left(x) --
  49. local function left(x)
  50.     turtle.turnLeft()
  51.     go(x)
  52. end
  53.  
  54. -- right(x) --
  55. local function right(x)
  56.     turtle.turnRight()
  57.     go(x)
  58. end
  59.  
  60. -- [MAIN FUNKTION] --
  61.  
  62. print("When you're done, type 'done'!")
  63.  
  64. repeat
  65.     y = io.read()
  66.     if y == "go" then
  67.         print("go(x)?")
  68.         x = io.read()
  69.         go(x)
  70.     end
  71.     if y == "up" then
  72.         print("up(x)?")
  73.         x = io.read()
  74.         up(x)
  75.     end
  76.     if y == "down" then
  77.         print("down(x)?")
  78.         x = io.read()
  79.         down(x)
  80.     end
  81.     if y == "left" then
  82.         print("left(x)?")
  83.         x = io.read()
  84.         left(x)
  85.     end
  86.     if y == "right" then
  87.         print("right(x)?")
  88.         x = io.read()
  89.         right(x)
  90.     end
  91. until y == "done"
  92.  
  93. -- [END] --
Advertisement
Add Comment
Please, Sign In to add comment