Paragorn

Advent 05

Dec 5th, 2013
230
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.21 KB | None | 0 0
  1. -- Variablen Vergeben
  2. Auswahl = 1 + 0
  3. Richtung = "Hoch"
  4. print("Wie Hoch ist die Wand?")
  5. Lang = io.read() - 1
  6. Lang2 = Lang + 1
  7. print("Gut sie wird "..Lang2.." Block hoch.")
  8.  
  9. print("Wie weit nach Rechts baue ich?")
  10. Breit = io.read()
  11. print("Einverstanden! "..Breit.." nach rechts.")
  12. print(" ")
  13. print("Ich arbeite in 5 Sekunden!")
  14. sleep(5)
  15. -- Funktionen
  16. function Wechsel()
  17.  if Richtung == "Hoch" then
  18.   turtle.turnRight()
  19.   turtle.forward()
  20.   turtle.turnLeft()
  21.   Richtung = "Runter"
  22.  elseif Richtung == "Runter" then
  23.   turtle.turnRight()
  24.   turtle.forward()
  25.   turtle.turnLeft()
  26.   Richtung = "Hoch"
  27.  end
  28. end
  29.  
  30. function Blockcheck()
  31.  if turtle.getItemCount(Auswahl) == 0 then
  32.   Auswahl = Auswahl + 1
  33.   turtle.select(Auswahl)
  34.  end
  35. end
  36.  
  37. -- Programm
  38. turtle.select(Auswahl)
  39. for i = 1,Breit do
  40. print(i)
  41.  if Richtung == "Hoch" then
  42.   Blockcheck()
  43.   turtle.place()
  44.   for i = 1,Lang do
  45.    turtle.up()
  46.    Blockcheck()
  47.    turtle.place()
  48.   end
  49.   Wechsel()
  50.  elseif Richtung == "Runter" then
  51.   Blockcheck()
  52.   turtle.place()
  53.   for i = 1,Lang do
  54.    turtle.down()
  55.    Blockcheck()
  56.    turtle.place()
  57.   end
  58.   Wechsel()
  59.  end
  60. end
  61.  
  62. if Richtung == "Runter" then
  63.  for i = 1,Lang do
  64.   turtle.down()
  65.  end
  66. end
Add Comment
Please, Sign In to add comment