Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Bitte stehle diesen Code nicht !
- -- Do not steel this scripts !
- -- #####################
- -- # MineOS - v1.3 #
- -- # by Mortimore #
- -- #####################
- version = "1.3"
- -- Abkuerzungen --
- function p(...) print(...) end
- function w(...) write(...) end
- function sp(...) textutils.slowPrint(...) end
- function sw(...) textutils.slowWrite(...) end
- function scp(...) term.setCursorPos(...) end
- function stc(...) term.setTextColor(...) end
- function sbc(...) term.setBackgroundColor(...) end
- function s(...) sleep(...) end
- function ts(...) turtle.select(...) end
- function wp(wpt,wppX,wppY,wptc,wpbc)
- scp(wppX,wppY)
- stc(wptc)
- sbc(wpbc)
- w(wpt)
- -- wpt = writePosText
- -- wppX = writePosPositionX
- -- wppY = writePosPositionY
- -- wptc = writePosTextColor
- -- wpbc = writePosBackgroundColor
- end
- function pp(ppt,pppX,pppY,pptc,ppbc)
- scp(pppX,pppY)
- stc(pptc)
- sbc(ppbc)
- p(ppt)
- -- ppt = printPosText
- -- pppX = printPosPositionX
- -- pppY = printPosPositionY
- -- pptc = printPosTextColor
- -- ppbc = printPosBackgroundColor
- end
- function screen(...)
- sbc(...)
- for o=1,19 do
- for p=1,39 do
- scp(p,o)
- w(" ")
- end
- end
- end
- function line()
- sbc(colors.black)
- stc(colors.white)
- p("---------------------------------------")
- end
- ------------------
- -- Funktionen --
- function Kiste(s)
- for i=1,s do
- ts(i)
- turtle.drop()
- end
- end
- function Dig()
- ts(1)
- if turtle.dig()==true then
- db = db + 1
- scp(1,6)
- term.clearLine()
- p("Bloecke abgebaut:" .. db)
- end
- if turtle.detect()==true then
- while turtle.detect()==true do
- turtle.dig()
- db = db + 1
- scp(1,6)
- term.clearLine()
- p("Bloecke abgebaut:" .. db)
- s(0.5)
- end
- end
- end
- function DigUp()
- turtle.select(1)
- if turtle.digUp()==true then
- db = db + 1
- term.setCursorPos(1,6)
- term.clearLine()
- print("Bloecke abgebaut:" .. db)
- end
- if turtle.detectUp()==true then
- while turtle.detectUp()==true do
- turtle.digUp()
- term.setCursorPos(1,6)
- term.clearLine()
- print("Bloecke abgebaut:" .. db)
- sleep(0.5)
- end
- end
- end
- function Place()
- if turtle.detect()==false then
- for n=1,13 do
- if turtle.getItemCount(n) > 0 then
- ts(n)
- tester = 0
- while turtle.detect()==false and turtle.getItemCount(n) > 0 and tester == 0 do
- if turtle.place()==false then
- tester = 1
- else
- bg = bg + 1
- scp(1,8)
- term.clearLine()
- p("Bloecke gesetzt:" .. bg)
- end
- s(0.5)
- end
- end
- end
- end
- end
- function PlaceUp()
- for n=1,13 do
- if turtle.getItemCount(n) > 0 then
- ts(n)
- turtle.placeUp()
- bg = bg + 1
- scp(1,8)
- term.clearLine()
- p("Bloecke gesetzt:" .. bg)
- end
- end
- end
- function PlaceDown()
- if turtle.detectDown()==false then
- for n=1,13 do
- if turtle.getItemCount(n) > 0 then
- ts(n)
- tester = 0
- while turtle.detectDown()==false and turtle.getItemCount(n) > 0 and tester == 0 do
- if turtle.placeDown()==false then
- tester = 1
- else
- bg = bg + 1
- scp(1,8)
- term.clearLine()
- p("Bloecke gesetzt:" .. bg)
- end
- s(0.5)
- end
- end
- end
- end
- end
- function Vor()
- while turtle.forward()==false do
- Dig()
- turtle.attack()
- end
- PlaceDown()
- end
- function Turn()
- turtle.turnLeft()
- turtle.turnLeft()
- end
- function Back()
- if turtle.back()==false then
- Turn()
- Vor()
- Turn()
- end
- end
- function Up()
- while turtle.up()==false do
- turtle.digUp()
- turtle.attackUp()
- end
- end
- function Down()
- while turtle.down()==false do
- turtle.attackDown()
- turtle.digDown()
- end
- end
- function Forward()
- Dig()
- Vor()
- DigUp()
- end
- function Fackel()
- if turtle.getItemCount(15) > 0 then
- fg = fg + 1
- scp(1,7)
- term.clearLine()
- p("Fackeln gesetzt:" .. fg)
- ts(15)
- turtle.placeUp()
- s(0.5)
- if turtle.detectUp()==false then
- turtle.up()
- turtle.turnLeft()
- Place()
- turtle.turnRight()
- Place()
- Dig()
- turtle.turnRight()
- Place()
- if a == ganganzahl then
- Dig()
- end
- turtle.turnRight()
- Place()
- Dig()
- PlaceUp()
- Down()
- ts(15)
- turtle.placeUp()
- Turn()
- end
- elseif turtle.getItemCount(16) > 0 then
- fg = fg + 1
- scp(1,7)
- term.clearLine()
- p("Fackeln gesetzt:" .. fg)
- ts(16)
- turtle.placeUp()
- s(0.5)
- if turtle.detectUp()==false then
- turtle.up()
- turtle.turnLeft()
- Place()
- turtle.turnRight()
- Place()
- Dig()
- turtle.turnRight()
- Place()
- if a == ganganzahl then
- Dig()
- end
- turtle.turnRight()
- Place()
- Dig()
- PlaceUp()
- Down()
- ts(16)
- turtle.placeUp()
- Turn()
- end
- end
- end
- function Leiter()
- if turtle.getItemCount(15) > 0 then
- ts(15)
- turtle.place()
- if turtle.detect()==false then
- Vor()
- turtle.turnLeft()
- Place()
- turtle.turnRight()
- Place()
- turtle.turnRight()
- Place()
- while turtle.back==false do
- Turn()
- Dig()
- turtle.attack()
- Turn()
- end
- ts(15)
- turtle.place()
- end
- elseif turtle.getItemCount(16) > 0 then
- ts(16)
- turtle.place()
- if turtle.detect()==false then
- Vor()
- turtle.turnLeft()
- Place()
- turtle.turnRight()
- Place()
- turtle.turnRight()
- Place()
- while turtle.back==false do
- Turn()
- Dig()
- turtle.attack()
- Turn()
- end
- ts(16)
- turtle.place()
- end
- end
- end
- function Seitengang(l)
- for i=1,l * 5 do
- Forward()
- end
- Turn()
- for i=1,l do
- Fackel()
- for j=1,5 do
- Vor()
- end
- end
- end
- ---------------
- -- Variablen --
- bg = 0
- fg = 0
- lg = 0
- f = 0
- db = 0
- ganganzahl = 0
- ganglaenge = 0
- c = 0
- a = 0
- b = 0
- kiste = 0
- j = 0
- et = 0
- m = 0
- ---------------
- shell.run("clear")
- sp("MineOs - v" .. version)
- sp("- von Mortimore -")
- s(1.5)
- -- Moduswahl --
- key = 0
- while key ~= 28 do
- screen(colors.black)
- shell.run("clear")
- stc(colors.white)
- sbc(colors.black)
- p("MineOS-".. version .." - Moduswahl 1/?")
- line()
- if m == 0 then
- wp(" Gang graben ",13,4,colors.black,colors.white)
- wp(" Schacht graben ",12,6,colors.white,colors.black)
- end
- if m == 1 then
- wp(" Gang graben ",13,4,colors.white,colors.black)
- wp(" Schacht graben ",12,6,colors.black,colors.white)
- wp(" Die GUI ist noch fehlerhaft! ",5,19,colors.black,colors.white)
- end
- mode, key = os.pullEvent("key")
- if mode == "key" then
- if key == 200 and m == 1 then
- m = 0
- elseif key == 208 and m == 0 then
- m = 1
- end
- end
- end
- stc(colors.white)
- sbc(colors.black)
- -------------------
- -- Modus "Gang mit Seitengängen graben" --
- if m == 0 then
- -- Gangoptionen alt --
- shell.run("clear")
- p("MineOS-1.3 - Gangoptionen 2/5")
- line()
- w("Anzahl der Gaenge: ")
- ganganzahl = tonumber(read())
- w("Laenge eines Gangs (x5): ")
- ganglaenge = tonumber(read())
- line()
- -----------------------
- -- Gangoptionen neu --
- -- key = 0
- -- taste = "+A"
- -- goa = 0
- -- gol = 0
- -- while key ~= 28 or taste ~= "weiter" do
- -- screen(colors.black)
- -- shell.run("clear")
- -- stc(colors.white)
- -- sbc(colors.black)
- -- p("MineOS-".. version .." - Gangoptionen 2/5")
- -- line()
- -- if taste == "-A" then
- -- wp(" ",18,4,colors.black,colors.white)
- -- wp("-",16,4,colors.black,colors.white)
- -- wp(goa,18,4,colors.black,colors.white)
- -- wp("+",22,4,colors.white,colors.black)
- -- wp("-",16,6,colors.white,colors.black)
- -- wp(gol,18,6,colors.white,colors.black)
- -- wp("+",22,6,colors.white,colors.black)
- -- wp("Weiter",18,8,colors.white,colors.black)
- -- elseif taste == "+A" then
- -- wp(" ",18,4,colors.black,colors.white)
- -- wp("-",16,4,colors.white,colors.black)
- -- wp(goa,18,4,colors.black,colors.white)
- -- wp("+",22,4,colors.black,colors.white)
- -- wp("-",16,6,colors.white,colors.black)
- -- wp(gol,18,6,colors.white,colors.black)
- -- wp("+",22,6,colors.white,colors.black)
- -- wp("Weiter",18,8,colors.white,colors.black)
- -- elseif taste == "-L" then
- -- wp(" ",18,6,colors.black,colors.white)
- -- wp("-",16,4,colors.white,colors.black)
- -- wp(goa,18,4,colors.white,colors.black)
- -- wp("+",22,4,colors.white,colors.black)
- -- wp("-",16,6,colors.black,colors.white)
- -- wp(gol,18,6,colors.black,colors.white)
- -- wp("+",22,6,colors.white,colors.black)
- -- wp("Weiter",18,8,colors.white,colors.black)
- -- elseif taste == "+L" then
- -- wp(" ",18,6,colors.black,colors.white)
- -- wp("-",16,4,colors.white,colors.black)
- -- wp(goa,18,4,colors.white,colors.black)
- -- wp("+",22,4,colors.white,colors.black)
- -- wp("-",16,6,colors.white,colors.black)
- -- wp(gol,18,6,colors.black,colors.white)
- -- wp("+",22,6,colors.black,colors.white)
- -- wp("Weiter",18,8,colors.white,colors.black)
- -- elseif taste == "weiter" then
- -- wp("-",16,4,colors.white,colors.black)
- -- wp(goa,18,4,colors.white,colors.black)
- -- wp("+",22,4,colors.white,colors.black)
- -- wp("-",16,6,colors.white,colors.black)
- -- wp(gol,18,6,colors.white,colors.black)
- -- wp("+",22,6,colors.white,colors.black)
- -- wp("Weiter",18,8,colors.black,colors.white)
- -- end
- -- wp(" Die Ganglaenge zaehlt 5-fach !! ",3,19,colors.black,colors.white)
- -- mode, key = os.pullEvent("key")
- -- if mode == "key" then
- -- if taste == "-A" then
- -- if key == 208 then
- -- taste = "-L"
- -- elseif key == 205 then
- -- taste = "+A"
- -- end
- -- elseif taste == "+A" then
- -- if key == 203 then
- -- taste = "-A"
- -- elseif key == 208 then
- -- taste = "+L"
- -- end
- -- elseif taste == "-L" then
- -- if key == 200 then
- -- taste = "-A"
- -- elseif key == 205 then
- -- taste = "+L"
- -- elseif key == 208 then
- -- taste = "weiter"
- -- end
- -- elseif taste == "+L" then
- -- if key == 200 then
- -- taste = "+A"
- -- elseif key == 203 then
- -- taste = "-L"
- -- elseif key == 208 then
- -- taste = "weiter"
- -- end
- -- elseif taste == "weiter" then
- -- if taste == 200 then
- -- taste = "-L"
- -- end
- -- elseif key == 28 then
- -- if taste == "-A" and goa > 0 then
- -- goa = goa - 1
- -- elseif taste == "+A" and goa < 999 then
- -- goa = goa + 1
- -- elseif taste == "-L" and gol > 4 then
- -- gol = gol - 5
- -- elseif taste == "+L" and gol < 246 then
- -- gol = gol + 5
- -- end
- -- end
- -- end
- -- end
- -- ganganzahl = goa + 0
- -- ganglaenge = gol / 5
- -- stc(colors.white)
- -- sbc(colors.black)
- ----------------------
- e = ""
- while e == "" or e == "r" do
- shell.run("clear")
- p("MineOS-1.3 - Kraftstoffverwaltung 3/5")
- line()
- p("Kraftstoff: " .. turtle.getFuelLevel())
- if (turtle.getFuelLevel() < 15 * ganglaenge * ganganzahl) then
- p("!Kraftstoff-Level-Warnung!")
- end
- zs = 0
- for i=1,16 do
- zs = turtle.getItemCount(i) + zs
- end
- p("!Auffuellung um " .. zs .. " Einheiten!")
- p("")
- p("Druecke 'Enter' zum aktuallisieren!")
- p("Schreibe 'r' zum auffuellen!")
- p("Schreibe etwas anderes zum fortfahren!")
- w("> ")
- e = read()
- if e == "r" then
- for i=1,16 do
- ts(i)
- turtle.refuel(64)
- end
- end
- end
- e = ""
- while e == "" or e == "s" do
- shell.run("clear")
- p("MineOS-1.3 - Ausruestung 4/5")
- line()
- p("EINE Truhe in Feld 14!")
- p("Fackeln in Feld 15+16!")
- line()
- f = turtle.getItemCount(15) + turtle.getItemCount(16)
- p("Fackeln: " .. f)
- w("Truhe: ")
- if turtle.getItemCount(14) == 1 then
- if et == 1 then
- p("Endertruhe")
- else
- p("Ja")
- end
- else
- p("Nein")
- end
- p("")
- p("Druecke 'Enter' zum aktuallisieren!")
- p("Schreibe 's' um die Truhe umzustellen!")
- p("Schreibe etwas, um fortzufahren!")
- w("> ")
- e = read()
- if e == "s" then
- if et == 0 then
- et = 1
- elseif et == 1 then
- et = 0
- end
- end
- end
- shell.run("clear")
- p("MineOS-1.3 - Uebersicht 5/5")
- line()
- p("Ganglaenge: " .. ganglaenge * 5)
- p("Ganganzahl: " .. ganganzahl)
- vg = ganganzahl - a
- p("Verbleibende Gaenge: " .. vg)
- if (turtle.getItemCount(14) == 1) then
- if et == 0 then
- turtle.turnLeft()
- Dig()
- Vor()
- DigUp()
- Back()
- turtle.select(14)
- turtle.place()
- turtle.turnRight()
- end
- kiste = 1
- end
- for j=0,ganganzahl - 1 do
- a = a + 1
- for k=1,3 do
- Forward()
- if kiste == 1 then
- c = c + 1
- end
- end
- turtle.turnLeft()
- Seitengang(ganglaenge)
- Seitengang(ganglaenge)
- turtle.turnRight()
- vg = ganganzahl - a
- term.setCursorPos(1,5)
- term.clearLine()
- print("Verbleibende Gaenge: " .. vg)
- if turtle.getFuelLevel() < a * 3 + 10 * ganglaenge + 100 then
- for k=0,j * 3 + 3 do
- Back()
- end
- turtle.turnLeft()
- Dig()
- Vor()
- DigUp()
- Turn()
- while turtle.getFuelLevel() < (ganganzahl - a) * (10 * ganglaenge + 30) do
- e = ""
- while e == "" or e == "r" do
- shell.run("clear")
- print("MineOS-" .. version .. " - !Kraftstoffwarnung! !")
- line()
- print("Kraftstoff: " .. turtle.getFuelLevel())
- zs = 0
- for i=1,16 do
- zs = turtle.getItemCount(i) + zs
- end
- print("!Auffuellung um " .. zs .. " Einheiten!")
- print("")
- print("Druecke 'Enter' zum aktuallisieren!")
- print("Schreibe 'r' zum auffuellen!")
- print("Schreibe etwas anderes zum fortfahren!")
- write("> ")
- e = read()
- if e == "r" then
- for i=1,16 do
- turtle.select(i)
- turtle.refuel(64)
- end
- end
- end
- end
- shell.run("clear")
- print("MineOS-" .. version .. " - Uebersicht 5/5")
- line()
- print("Ganglaenge: " .. ganglaenge * 5)
- print("Ganganzahl: " .. ganganzahl)
- vg = ganganzahl - a
- print("Verbleibende Gaenge: " .. vg)
- Vor()
- turtle.turnLeft()
- for k=0,j * 3 + 3 do
- Vor()
- end
- end
- if a ~= ganganzahl then
- if c == 6 and et == 0 then
- for k=0,j * 3 + 2 do
- Back()
- end
- turtle.turnLeft()
- Kiste(14)
- turtle.turnRight()
- for k=0,j * 3 + 2 do
- Vor()
- end
- c = 0
- elseif c == 6 and et == 1 then
- Dig()
- turtle.select(14)
- turtle.place()
- Kiste(13)
- turtle.select(14)
- turtle.dig()
- end
- end
- if a == ganganzahl then
- for k=0,a * 3 do
- Back()
- end
- DigUp()
- turtle.turnLeft()
- Dig()
- Vor()
- DigUp()
- Fackel()
- turtle.turnRight()
- if kiste == 1 then
- if et == 0 then
- Kiste(16)
- elseif et == 1 then
- Dig()
- turtle.select(14)
- turtle.place()
- Kiste(16)
- turtle.select(14)
- turtle.dig()
- end
- end
- turtle.turnRight()
- print("")
- print("!Fertig!")
- end
- end
- end
- -- Modus Gang mit Seitengängen graben: ENDE --
- -- Modus Schacht graben --
- if m == 1 then
- shell.run("clear")
- print("MineOS-" .. version .. " - Schachtoptionen 2/4")
- line()
- write("Laenge des Schachts: ")
- schachtlaenge = tonumber(read())
- write("Tiefe des Schachts: ")
- schachttiefe = tonumber(read())
- line()
- e = ""
- while e == "" or e == "r" do
- shell.run("clear")
- print("MineOS-" .. version .. " - Kraftstoffverwaltung 3/4")
- line()
- print("Kraftstoff: " .. turtle.getFuelLevel())
- if (turtle.getFuelLevel() < (schachtlaenge * schachtlaenge * schachttiefe) + 50) then
- print("!Kraftstoff-Level-Warnung!")
- end
- zs = 0
- for i=1,16 do
- zs = turtle.getItemCount(i) + zs
- end
- print("!Auffuellung um " .. zs .. " Einheiten!")
- print("")
- print("Druecke 'Enter' zum aktuallisieren!")
- print("Schreibe 'r' zum auffuellen!")
- print("Schreibe etwas anderes zum fortfahren!")
- write("> ")
- e = read()
- if e == "r" then
- for i=1,16 do
- turtle.select(i)
- turtle.refuel(64)
- end
- end
- end
- e = ""
- while e == "" do
- shell.run("clear")
- print("MineOS-" .. version .. " - Ausruestung 4/4")
- line()
- print("EINE Truhe in Feld 14!")
- print("Leitern in Feld 15+16!")
- line()
- f = turtle.getItemCount(15) + turtle.getItemCount(16)
- print("Leitern: " .. f)
- write("Truhe: ")
- if turtle.getItemCount(14) == 1 then
- print("Ja")
- else
- print("Nein")
- end
- print("")
- print("Druecke 'Enter' zum aktuallisieren!")
- print("Schreibe etwas, um fortzufahren!")
- write("> ")
- e = read()
- end
- shell.run("clear")
- if (turtle.getItemCount(14) == 1) then
- if et == 0 then
- turtle.turnLeft()
- Dig()
- Vor()
- DigUp()
- Back()
- turtle.select(14)
- turtle.place()
- turtle.turnRight()
- end
- kiste = 1
- end
- for i=0,schachttiefe - 1 do
- turtle.digDown()
- Down()
- c = c + 1
- sr = "rechts"
- for j=0,schachtlaenge - 1 do
- for k=0,(schachtlaenge) - 2 do
- Vor()
- end
- if j ~= schachtlaenge - 1 then
- if sr == "rechts" then
- turtle.turnRight()
- Vor()
- turtle.turnRight()
- sr = "links"
- elseif sr == "links" then
- turtle.turnLeft()
- Vor()
- turtle.turnLeft()
- sr = "rechts"
- end
- end
- end
- if sr == "rechts" then
- turtle.turnLeft()
- for k=0,schachtlaenge - 2 do
- Vor()
- end
- turtle.turnLeft()
- for k=0,schachtlaenge - 2 do
- Vor()
- end
- if c == 2 then
- turtle.turnRight()
- elseif i == schachttiefe then
- else
- Turn()
- end
- elseif sr == "links" then
- turtle.turnRight()
- for k=0,schachtlaenge - 2 do
- Vor()
- end
- if c ~= 2 then
- turtle.turnRight()
- elseif i == schachttiefe then
- turtle.turnLeft()
- end
- end
- if kiste == 1 and c == 2 and i ~= schachttiefe then
- if et == 0 then
- for j = 0,i do
- Up()
- end
- Kiste(14)
- turtle.turnRight()
- for j = 0,i do
- Down()
- end
- end
- c = 0
- end
- end
- Turn()
- for i=0,schachttiefe - 1 do
- Dig()
- Leiter()
- Up()
- end
- Vor()
- turtle.turnRight()
- Vor()
- if kiste == 1 then
- turtle.turnRight()
- Kiste(16)
- turtle.turnRight()
- else
- Turn()
- end
- print("")
- print("Fertig!")
- end
- -- Modus Schacht graben: ENDE --
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement