Advertisement
BillBodkin

placeTorchesWithinWalls

Oct 16th, 2021 (edited)
1,110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.00 KB | None | 0 0
  1. local c = 0
  2. local r = 0
  3.  
  4. turtle.up()
  5.  
  6. function Step()
  7.     if turtle.forward() == false then
  8.         return false
  9.     end
  10.     c = c + 1
  11.     if c % 5 == 0 then
  12.         while turtle.getItemCount(1) <= 1 do
  13.             print("Getting torches")
  14.             turtle.digUp()
  15.             turtle.select(16)
  16.             turtle.placeUp()
  17.             turtle.select(1)
  18.             turtle.suckUp(64)
  19.             turtle.select(16)
  20.             turtle.digUp()
  21.             turtle.select(1)
  22.         end
  23.         turtle.placeDown()
  24.     end
  25.     return true
  26. end
  27.  
  28. while true do
  29.     while Step() do
  30.         print("Step")
  31.     end
  32.    
  33.     r = r + 1
  34.    
  35.     function turn()
  36.         if r % 2 == 1 then
  37.             turtle.turnRight()
  38.         else
  39.             turtle.turnLeft()
  40.         end
  41.     end
  42.    
  43.     turn()
  44.     for i = 1, 5 do
  45.         if turtle.forward() == false then
  46.             print("done")
  47.             while true do
  48.                 sleep(100)
  49.             end
  50.         end
  51.     end
  52.     turn()
  53. end
  54.  
  55.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement