Z4i

Stairs upwards

Z4i
Dec 20th, 2017
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.14 KB | None | 0 0
  1. local arg = ...
  2. local arg1 = tonumber(arg)
  3. arg1 = arg1-1
  4. local counter = 0
  5. local last = ""
  6. function placeUpLeft()
  7.     turtle.placeUp()
  8.     turtle.turnLeft()
  9.     turtle.forward()
  10.     turtle.turnRight()
  11. end
  12.  
  13. function placeUpRight()
  14.     turtle.placeUp()
  15.     turtle.turnRight()
  16.     turtle.forward()
  17.     turtle.turnLeft()
  18. end
  19.  
  20. function up()
  21.     turtle.forward()
  22.     turtle.up()
  23. end
  24.  
  25. function back()
  26.     if last == "left" then
  27.         turtle.turnLeft()
  28.     elseif last == "right" then
  29.         turtle.turnRight()
  30.     end
  31.     turtle.forward()
  32.     turtle.turnLeft()
  33.     turtle.turnLeft()
  34.     turtle.up()
  35.     turtle.forward()
  36.     if last == "left" then
  37.         turtle.turnRight()
  38.     elseif last == "right" then
  39.         turtle.turnLeft()
  40.     end
  41.     for i=0, arg1 do
  42.         turtle.forward()
  43.         turtle.down()
  44.     end
  45.     turtle.forward()
  46.     os.reboot()
  47. end
  48.  
  49. for j = 1, arg1 do
  50.     placeUpLeft()
  51.     placeUpLeft()
  52.     turtle.placeUp()
  53.     last = "left"
  54.     up()
  55.     counter = counter + 1
  56.     print(counter)
  57.     if counter > arg1 then
  58.         print("Back()")
  59.         back()
  60.     end
  61.     placeUpRight()
  62.     placeUpRight()
  63.     turtle.placeUp()
  64.     last = "right"
  65.     up()
  66.     counter = counter + 1
  67.     print(counter)
  68.     if counter > arg1
  69. then
  70.         print("Back()")
  71.         back()
  72.     end
  73. end
Advertisement
Add Comment
Please, Sign In to add comment