slay_mithos

stairs

May 12th, 2013
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.59 KB | None | 0 0
  1. local args = {...}
  2. local length = 1
  3. local height = 6
  4.  
  5. if (args[1] ~= nil) then
  6.     length = args[1]
  7.     if (args[2] ~= nil) then
  8.         height = args[2]
  9.     end
  10. end
  11.  
  12. local function dig()
  13.     while (not turtle.forward()) do
  14.         turtle.dig()
  15.     end
  16. end
  17.  
  18. local function back()
  19.     while (not turtle.back()) do
  20.         turtle.turnRight()
  21.         turtle.turnRight()
  22.         turtle.dig()
  23.         turtle.turnRight()
  24.         turtle.turnRight()
  25.     end
  26. end
  27.  
  28.  
  29. local function loop()
  30.     for i=1, length do
  31.         for j=1, height do
  32.             dig()
  33.         end
  34.         for j=2, height do
  35.             back()
  36.         end
  37.         turtle.digDown()
  38.         turtle.down()
  39.     end
  40. end
  41.  
  42.  
  43. loop()
Advertisement
Add Comment
Please, Sign In to add comment