Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local Version = "1.5.2"
- --Changelog:
- --Version 1.5.2: Turtle didn't dig up. Now it does
- --Version 1.5.1: Fixed a bug in a function
- --Version 1.5: More compact and digs correctly now
- --Version 1.4: Bug of 1.3 fixed :)
- --Version 1.3 More fixes, code more compact, a new bug
- --Version 1.1: Fixes
- --Version 1.0: First Release
- shell.run('clear')
- local bslot, fuel, fuelV, contatoreDritto, contatoreSopra, contatoreToT, pulsante, lang, pulsanteSX, pulsanteDX = 1, 2, 0, 0, 0, 0, 28, false, 203, 205
- local str1, str2, str3, str4, str5, str6, str7, str8, str9, str10, str11, str12, str13
- local str1IT = "INIZIALIZZAZIONE PROGRAMMA, ATTENDERE :)"
- local str1EN = "PROGRAM INITIALIZATION, PLEASE WAIT :)"
- local str2IT = "Programma per scavare"
- local str2EN = "Digging Program"
- local str3IT = "Versione "
- local str3EN = "Version "
- local str4IT = "Realizzato da stefa168"
- local str4EN = "Made By stefa168"
- local str5IT = "Prima di tutto, inserisci nello slot 2 del carburante!"
- local str5EN = "First, put in slot 2 some fuel!"
- local str6IT = "Fai attenzione, perchè se il carburante finisce dovrai riavviare il programma e rimetterne altro!"
- local str6EN = "Be careful, because if fuel ends you will have to restart the program and put more fuel!"
- local str7IT = "Quando l'hai messo, premi INVIO"
- local str7EN = "When you put it in, press ENTER"
- local str8IT = "Attendi un secondo mentre utilizzo il carburante che hai messo..."
- local str8EN = "Hold on while I use the fuel you gave me..."
- local str9IT = "Selezionato lo slot del carburante"
- local str9EN = "Fuel slot selected"
- function waitKey(par1)
- while true do
- local sEvent, param = os.pullEvent("key")
- if sEvent == "key" then
- if param == par1 then
- break
- end
- end
- end
- end
- function scavaSopra(mex)
- if turtle.detectUp() then
- if mex then
- turtle.digUp()
- print("Scavo il blocco sopra..")
- contatoreSopra = contatoreSopra + 1
- print("Questo e' il blocco (sopra) numero "..tostring(contatoreSopra))
- contatoreTot = contatoreSopra + contatoreDritto
- else
- turtle.digUp()
- contatoreSopra = contatoreSopra + 1
- end
- end
- end
- print("Hello! Ciao!")
- print("Press the left keyboard arrow if you speak english!")
- print("Se parli italiano, premi la freccia destra sulla tastiera!")
- while true do
- local sEvent, param = os.pullEvent("key")
- if sEvent == "key" then
- if param == pulsanteSX then
- str1 = str1EN
- str2 = str2EN
- str3 = str3EN
- str4 = str4EN
- str5 = str5EN
- str6 = str6EN
- str7 = str7EN
- str8 = str8EN
- str9 = str9EN
- str10 = str10EN
- str11 = str11EN
- str12 = str12EN
- str13 = str13EN
- break
- elseif param == pulsanteDX then
- str1 = str1IT
- str2 = str2IT
- str3 = str3IT
- str4 = str4IT
- str5 = str5IT
- str6 = str6IT
- str7 = str7IT
- str8 = str8IT
- str9 = str9IT
- str10 = str10IT
- str11 = str11IT
- str12 = str12IT
- str13 = str13IT
- break
- end
- end
- end
- print(str1)
- sleep(1)
- shell.run('clear')
- print(str2)
- print(str3..tostring(Version))
- print(str4)
- sleep(2)
- shell.run('clear')
- print(str5)
- print(str6)
- print(str7)
- waitKey(pulsante)
- shell.run('clear')
- print(str8)
- turtle.select(fuel)
- print(str9)
- turtle.refuel()
- print("Utilizzato il carburante")
- fuelV = turtle.getFuelLevel()
- print("Ora il livello del carburante e' "..tostring(fuelV).."!")
- turtle.select(bslot)
- print("Selezionato lo slot primario!")
- sleep(1)
- shell.run('clear')
- print("Ora, per favore, metti in slot 1 il blocco che fermera' il programma.")
- print("Quando l'hai fatto, premi INVIO")
- waitKey(pulsante)
- shell.run('clear')
- print("Ok, inizio a scavare tra 5 secondi!")
- sleep(2)
- for i = 0,2 do
- shell.run('clear')
- print(3-i)
- sleep(1)
- end
- scavaSopra(false)
- shell.run('clear')
- while not turtle.compare() do
- scavaSopra(true)
- turtle.dig()
- print("Scavo il blocco....")
- contatoreDritto = contatoreDritto + 1
- print("Questo e' il blocco (dritto) numero "..tostring(contatoreDritto))
- print("Finora sono stati scavati "..tostring(contatoreTot).." blocchi in tutto!")
- turtle.forward()
- end
- turtle.digUp()
- shell.run('clear')
- print("Ho raggiunto la fine del mio percorso dopo aver scavato "..tostring(contatoreTot).." blocchi!")
- print("Ora torno indietro!")
- for i=1, contatoreDritto do
- turtle.back()
- end
- print("Ho finito il mio lavoro!")
- sleep(3)
- print("DEBUG: FINE PROGRAMMA")
Advertisement
Add Comment
Please, Sign In to add comment