towwey

TurtleBridge

Sep 9th, 2021 (edited)
211
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. slot1 = 2
  2. slot2 = 3
  3. function treibstoff()
  4.  turtle.select(1)
  5.  turtle.refuel(1)
  6. end
  7. function hindernisvor()
  8.  while turtle.detect() do
  9.   turtle.dig()
  10.  end
  11. end
  12. function hindernisauf()
  13.  while turtle.detectUp() do
  14.   turtle.digUp()
  15.  end
  16. end
  17. function hindernisab()
  18.  while turtle.detectDown() do
  19.   turtle.digDown()
  20.  end
  21. end
  22. function vor()
  23.  if turtle.getFuelLevel() < 10 then
  24.   treibstoff()
  25.  end
  26.  while turtle.forward() == false do
  27.   hindernisvor()
  28.   turtle.attack()
  29.  end
  30. end
  31. function auf()
  32.  if turtle.getFuelLevel() < 10 then
  33.   treibstoff()
  34.  end
  35.  while turtle.up() == false do
  36.   hindernisauf()
  37.   turtle.attackUp()
  38.  end
  39. end
  40. function ab()
  41.  if turtle.getFuelLevel() < 10 then
  42.   treibstoff()
  43.  end
  44.  while turtle.down() == false do
  45.   hindernisab()
  46.   turtle.attackDown()
  47.  end
  48. end
  49. function setzen()
  50.  if turtle.getItemCount(slot1) == 0 then
  51.   slot1 = slot1 + 2
  52.  end
  53.  turtle.select(slot1)
  54.  turtle.placeDown()
  55. end
  56. function setzenzaun()
  57.  if turtle.getItemCount(slot2) == 0 then
  58.   slot2 = slot2 + 2
  59.  end
  60.  turtle.select(slot2)
  61.  turtle.placeDown()
  62. end
  63. term.clear()
  64. term.setCursorPos(1,1)
  65. print("Please put fuel in slot 1!")
  66. print("Please place platform or roof material in slot 2, 4, 6, 8, 10, 12, 14 and 16!")
  67. print("If the fence mode is activated, please place the fence material in slot 3, 5, 7, 9, 11, 13 and 15!")
  68. print("Press any key to continue!")
  69. os.pullEvent("key")
  70. shell.run("clear")
  71. print("How long should the bridge be?")
  72. term.setCursorPos(22,12)
  73. print("(c)vantheman1wald")
  74. term.setCursorPos(1,2)
  75. write("Length:")
  76. laenge = tonumber(read())
  77. term.clearLine()
  78. term.setCursorPos(1,1)
  79. term.clearLine()
  80. print("Length:"..laenge)
  81. print("How wide should the bridge be?")
  82. write("Width:")
  83. breite = tonumber(read())
  84. term.clearLine()
  85. term.setCursorPos(1,2)
  86. term.clearLine()
  87. print("Width:"..breite)
  88. print("In which direction should the turtle build? (Left or right)")
  89. write("Direction:")
  90. richtung = read()
  91. term.clearLine()
  92. term.setCursorPos(1,3)
  93. term.clearLine()
  94. print("Direction:"..richtung)
  95. if string.lower(richtung) == "rechts" then
  96.  richtung = "turnRight"
  97. end
  98. if string.lower(richtung) == "links" then
  99.  richtung = "turnLeft"
  100. end
  101. print("Should the turtle build a:")
  102. print("1) platform")
  103. Print("2) a bridge with a fence")
  104. Print("3) a covered bridge")
  105. Print("1, 2 or 3")
  106. write("Number:")
  107. zaun = read()
  108. term.setCursorPos(1,4)
  109. term.clearLine()
  110. print("Number:"..zaun)
  111. term.setCursorPos(1,5)
  112. term.clearLine()
  113. term.setCursorPos(1,6)
  114. term.clearLine()
  115. term.setCursorPos(1,7)
  116. term.clearLine()
  117. term.setCursorPos(1,8)
  118. term.clearLine()
  119. if string.lower(zaun) == "1" then
  120.  turtle.placeDown()
  121.  for a = 1, laenge do
  122.  turtle[richtung]()
  123.   for x = 2, breite do
  124.    setzen()
  125.    vor()
  126.   end
  127.   setzen()
  128.   auf()
  129.   setzenzaun()
  130.   for asdf = 0,1 do
  131.    turtle[richtung]()
  132.   end
  133.   for c = 2, breite do
  134.    vor()
  135.   end
  136.   setzenzaun()
  137.   turtle[richtung]()
  138.   vor()
  139.   ab()
  140.  end
  141. end
  142.  
  143. if string.lower(zaun) == "2" then
  144.  for d = 1, laenge do
  145.   setzen()
  146.   turtle[richtung]()
  147.    for y = 2, breite do
  148.     vor()
  149.     setzen()
  150.    end
  151.    for ad = 0,2 do
  152.     turtle[richtung]()
  153.    end
  154.    vor()
  155.    for af = 0,2 do
  156.     turtle[richtung]()
  157.    end
  158.    for f = 2, breite do
  159.     vor()
  160.    end
  161.    turtle[richtung]()
  162.   end
  163.  end
  164.  
  165. if string.lower(zaun) == "3" then
  166.  turtle.placeDown()
  167.  for a = 1, laenge do
  168.   turtle[richtung]()
  169.    for x = 2, breite do
  170.     setzen()
  171.     vor()
  172.    end
  173.    setzen()
  174.    auf()
  175.    setzenzaun()
  176.    for xy = 1,2 do
  177.     turtle[richtung]()
  178.    end
  179.    for c = 2, breite do
  180.     vor()
  181.    end
  182.    setzenzaun()
  183.    auf()
  184.    setzenzaun()
  185.    for xy = 1,2 do
  186.     turtle[richtung]()
  187.    end
  188.    for c = 2, breite do
  189.     vor()
  190.    end
  191.    setzenzaun()
  192.    auf()
  193.    setzenzaun()
  194.    for xy = 1,2 do
  195.     turtle[richtung]()
  196.    end
  197.    for c = 2, breite do
  198.     vor()
  199.    end
  200.    setzenzaun()
  201.    auf()
  202.    setzen()
  203.    for xy = 1,2 do
  204.     turtle[richtung]()
  205.    end
  206.    for c = 2, breite do
  207.     vor()
  208.     setzen()
  209.    end
  210.    for xy = 1,2 do
  211.     turtle[richtung]()
  212.    end
  213.    for c = 2, breite do
  214.     vor()
  215.    end
  216.    turtle[richtung]()
  217.    vor()
  218.    for xyz = 1,4 do
  219.     ab()
  220.    end
  221.   end
  222.  end
  223. turtle.select(1)
  224. term.clear()
  225. term.setCursorPos(1,1)
Add Comment
Please, Sign In to add comment