Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Dieses Programm ist fuer eine vereinfachte Benutzung der Turtle aus Computercraft
- function vor()
- if turtle.detect() then
- print("")
- print("Fehler : Turtle kann sich nicht bewegen")
- else
- if turtle.getFuelLevel() == 0 then
- print("")
- print("Fehler : Kein Treibstoff")
- else
- turtle.forward()
- print("Vorwaerts")
- end
- end
- end
- function zurueck()
- if turtle.getFuelLevel() == 0 then
- print("")
- print("Fehler : Kein Treibstoff")
- else
- turtle.back()
- print("Zurueck")
- end
- end
- function links()
- if turtle.getFuelLevel() == 0 then
- print("")
- print("Fehler : Kein Treibstoff")
- else
- turtle.turnLeft()
- if turtle.detect() then
- print("")
- print("Fehler : Turtle kann sich nicht bewegen")
- else
- turtle.forward()
- print("Links")
- end
- turtle.turnRight()
- end
- end
- function rechts()
- if turtle.getFuelLevel() == 0 then
- print("")
- print("Fehler : Kein Treibstoff")
- else
- turtle.turnRight()
- if turtle.detect() then
- print("")
- print("Fehler : Turtle kann sich nicht bewegen")
- else
- turtle.forward()
- print("Rechts")
- end
- turtle.turnLeft()
- end
- end
- function hoch()
- if turtle.detectUp() then
- print("")
- print("Fehler : Turtle kann sich nicht bewegen")
- else
- if turtle.getFuelLevel() == 0 then
- print("")
- print("Fehler : Kein Treibstoff")
- else
- turtle.up()
- print("Hoch")
- end
- end
- end
- function runter()
- if turtle.detectDown() then
- print("")
- print("Fehler: Turtle kann sich nicht bewegen")
- else
- if turtle.getFuelLevel() == 0 then
- print("")
- print("Fehler : Kein Treibstoff")
- else
- turtle.down()
- print("Runter")
- end
- end
- end
- function rechtsDrehen()
- turtle.turnRight()
- print("Nach Rechts drehen")
- end
- function linksDrehen()
- turtle.turnLeft()
- print("Nach Links drehen")
- end
- function grab()
- if turtle.detect() then
- turtle.dig()
- print("Vorne Graben")
- else
- print("")
- print("Fehler : Kein Block gefunden")
- end
- end
- function grabRunter()
- if turtle.detectDown() then
- turtle.digDown()
- print("Runter Graben")
- else
- print("")
- print("Fehler : Kein Block gefunden")
- end
- end
- function grabHoch()
- if turtle.detectUp() then
- turtle.digUp()
- print("Hoch Graben")
- else
- print("")
- print("Fehler : Kein Block gefunden")
- end
- end
- function fuel()
- print("")
- print("Treibstoff: "..turtle.getFuelLevel())
- end
- function refuel()
- turtle.refuel()
- print("")
- print("Treibstoff: "..turtle.getFuelLevel())
- end
- function exit()
- term.clear()
- term.setCursorPos(1,1)
- print("Programm beendet")
- print("Computer wird in kuerze neustarten")
- os.sleep(1)
- os.reboot()
- end
- function clear()
- term.clear()
- term.setCursorPos(0,0)
- end
- function version()
- print("")
- print("eZ-Shell v.1.5")
- print("von David_10101")
- end
- function select()
- print("")
- print("Welchen Slot auswaehlen?")
- print("")
- local slot = read()
- slot = tonumber(slot)
- if slot < 1 then
- print("")
- print("Fehler : Slot nicht real")
- elseif slot > 16 then
- print("")
- print("Fehler : Slot nicht real")
- else
- turtle.select(slot)
- end
- print("")
- end
- function help()
- term.clear()
- term.setCursorPos(1,1)
- term.write("Verfuegbare Kommandos")
- print("")
- term.write("Bewegen:")
- print("")
- term.write("vor, zurueck, links, rechts, drehLinks,")
- print("drehRechts")
- print("")
- term.write("Graben:")
- print("")
- term.write("grab, grabHoch, grabRunter")
- print("")
- print("")
- term.write("Treibstoff:")
- print("")
- term.write("fuel, refuel")
- print("")
- print("")
- term.write("Shell-Kommandos:")
- print("")
- term.write("exit, clear, version, ab, select")
- end
- function abkuerzung()
- term.clear()
- term.setCursorPos(1,1)
- term.write("Bewegen:")
- print("")
- term.write("v, z, r, h, l, re, dl, dr")
- print("")
- term.write("Graben:")
- print("")
- term.write("g, gh, grr")
- print("")
- print("")
- term.write("Treibstoff:")
- print("")
- term.write("f, rf")
- print("")
- print("")
- term.write("Shell-Kommandos:")
- print("")
- term.write("e, c, ve, ab, s")
- end
- term.clear()
- term.setCursorPos(1,1)
- term.write("eZ-Shell v.1.5")
- sleep(0.5)
- while true do
- print("")
- command = read()
- if command == "vor" then
- vor()
- elseif command == "v" then
- vor()
- elseif command == "zurueck" then
- zurueck()
- elseif command == "z" then
- zurueck()
- elseif command == "links" then
- links()
- elseif command == "l" then
- links()
- elseif command == "rechts" then
- rechts()
- elseif command == "re" then
- rechts()
- elseif command == "hoch" then
- hoch()
- elseif command == "h" then
- hoch()
- elseif command == "runter" then
- runter()
- elseif command == "r" then
- runter()
- elseif command == "drehRechts" then
- rechtsDrehen()
- elseif command == "dr" then
- rechtsDrehen()
- elseif command == "drehLinks" then
- linksDrehen()
- elseif command == "dl" then
- linksDrehen()
- elseif command == "grab" then
- grab()
- elseif command == "g" then
- grab()
- elseif command == "grabHoch" then
- grabHoch()
- elseif command == "gh" then
- grabHoch()
- elseif command == "grabRunter" then
- grabRunter()
- elseif command == "gr" then
- grabRunter()
- elseif command == "fuel" then
- fuel()
- elseif command == "f" then
- fuel()
- elseif command == "rf" then
- refuel()
- elseif command == "refuel" then
- refuel()
- elseif command == "exit" then
- exit()
- elseif command == "help" then
- help()
- elseif command == "clear" then
- clear()
- elseif command == "c" then
- clear()
- elseif command == "version" then
- version()
- elseif command == "ve" then
- version()
- elseif command == "ab" then
- abkuerzung()
- elseif command == "e" then
- exit()
- elseif command == "select" then
- select()
- elseif command == "s" then
- select()
- else
- print("Fehler : Unbekannter Kommando")
- print("")
- print("Kommandoliste mit help")
- print("Abkuerzungen mit ab")
- print("")
- os.sleep(1)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment