Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Bewegen der Turtle mehrschrittig
- -- Vorgabewerte erfragen
- term.clear()
- term.setCursorPos(1,1)
- print("Wie viele Schritte soll die Turtle bewegt werden?")
- stepAmount = io.read()
- print("In welche Richtung soll die Turtle die Schritte gehen?")
- print("[v]orwärts [l]inks [r]echts [z]urück")
- direction = io.read()
- stepAmount = stepAmount + 0
- -- Brennmaterialbedarf ermitteln und befüllen
- function fuelCheck()
- local fuelNeed = stepAmount
- local currentFuel = turtle.getFuelLevel()
- if currentFuel < fuelNeed then
- print("Zu wenig Treibstoff. " .. currentFuel .. "/" .. fuelNeed)
- print("Bitte Slot angeben in dem der Treibstoff liegt:")
- local k = io.read()
- k = k + 0
- turtle.select(k)
- turtle.refuel()
- sleep(0.5)
- fuelCheck()
- else
- print("Treibstoffbedarf gedeckt: " .. currentFuel .. "/" .. fuelNeed)
- sleep(0.5)
- end
- end
- fuelCheck()
- -- rückwärts
- if direction == "z" then
- for i=1,stepAmount do
- turtle.back()
- end
- end
- -- links
- if direction == "l" then
- turtle.turnLeft()
- direction = "v"
- end
- -- rechts
- if direction == "r" then
- turtle.turnRight()
- direction = "v"
- end
- -- vorwärts
- if direction == "v" then
- for i=1,stepAmount do
- turtle.forward()
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment