Advertisement
nstjlol

TCP.lua

Oct 22nd, 2021
860
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. goLeft = false
  2. coalSlots = {1,5,9,13}
  3. iFuel = 1
  4. print("Enter L or R")
  5. direction = read()
  6. if direction == "l" then
  7.     goLeft = true
  8. end
  9. print("Enter x:")
  10. x = tonumber(read())
  11. print("Enter y:")
  12. y = tonumber(read()) - 1
  13. yT = y
  14.  
  15. function refuelT ()
  16.     turtle.select(coalSlots[iFuel])
  17.     turtle.refuel()
  18.     iFuel = iFuel + 1
  19. end
  20.  
  21. refuelT()
  22. while x >= 1 do
  23.     y = yT
  24.     while y >= 1 do
  25.         print(y)
  26.         turtle.digUp()
  27.         turtle.dig()
  28.         while turtle.detect() == true do
  29.             turtle.dig()
  30.             sleep(0.5)
  31.         end
  32.         turtle.forward()
  33.         y = y - 1
  34.     end
  35.     print(x)
  36.     if goLeft == true then
  37.         turtle.digUp()
  38.         turtle.turnLeft()
  39.         turtle.dig()
  40.         while turtle.detect() == true do
  41.             turtle.dig()
  42.             sleep(0.5)
  43.         end
  44.         turtle.forward()
  45.         turtle.digUp()
  46.         turtle.turnLeft()
  47.         goLeft = false
  48.     else
  49.         turtle.digUp()
  50.         turtle.turnRight()
  51.         turtle.dig()
  52.         while turtle.detect() == true do
  53.             turtle.dig()
  54.             sleep(0.5)
  55.         end
  56.         turtle.forward()
  57.         turtle.digUp()
  58.         turtle.turnRight()
  59.         goLeft = true
  60.     end
  61.     x = x - 1
  62. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement