Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- fix
- local meuid = tonumber(os.computerID())
- -- functions de blocos
- local function f()
- turtle.forward()
- end
- local function d()
- turtle.down()
- end
- local function sai()
- turtle.turnRight()
- turtle.turnRight()
- turtle.back()
- end
- local function roda()
- turtle.turnRight()
- turtle.turnRight()
- turtle.back()
- end
- local function df()
- turtle.dig() turtle.forward()
- end
- local function sobe()
- turtle.up()
- end
- local function b0()
- turtle.back()
- end
- local function b1()
- turtle.back()
- turtle.place()
- end
- local function return1()
- sobe() f() f() f() f() f() f()
- d() d() d() d() d()
- end
- local function return2()
- b0() b0() b0() b0() b0()
- d() d() d() d()
- turtle.turnRight()
- turtle.turnRight()
- end
- -- functions de letras usando os blocos
- local function letraA()
- b0()
- b1() b0() b0() b0() b1() sobe() roda()
- b1() b0() b0() b0() b1() sobe() roda()
- b1() b1() b1() b1() b1() sobe() roda()
- b1() b0() b0() b0() b1() sobe() roda()
- b0() b1() b1() b1() b0()
- end
- local function letraB()
- b0()
- b1() b1() b1() b1() b1() sobe() roda()
- b1() b0() b0() b0() b1() sobe() roda()
- b1() b1() b1() b1() b1() sobe() roda()
- b0() b1() b0() b0() b1() sobe() roda()
- b1() b1() b1() b1() b0()
- end
- local function letraC()
- b0()
- b1() b1() b1() b1() b1() sobe() roda()
- b0() b0() b0() b0() b1() sobe() roda()
- b1() b0() b0() b0() b0() sobe() roda()
- b0() b0() b0() b0() b1() sobe() roda()
- b1() b1() b1() b1() b1()
- end
- local function letraD()
- b0()
- b1() b1() b1() b1() b1() sobe() roda()
- b1() b0() b0() b0() b1() sobe() roda()
- b1() b0() b0() b0() b1() sobe() roda()
- b1() b0() b0() b0() b1() sobe() roda()
- b1() b1() b1() b1() b1()
- end
- local function letraE()
- b0()
- b1() b1() b1() b1() b1() sobe() roda()
- b0() b0() b0() b0() b1() sobe() roda()
- b1() b1() b1() b1() b0() sobe() roda()
- b0() b0() b0() b0() b1() sobe() roda()
- b1() b1() b1() b1() b1()
- end
- local function letraF()
- b0()
- b1() b0() b0() b0() b0() sobe() roda()
- b0() b0() b0() b0() b1() sobe() roda()
- b1() b1() b1() b1() b0() sobe() roda()
- b0() b0() b0() b0() b1() sobe() roda()
- b1() b1() b1() b1() b1()
- end
- local function letraG()
- b0()
- b1() b1() b1() b1() b1() sobe() roda()
- b1() b0() b0() b0() b1() sobe() roda()
- b1() b0() b0() b1() b1() sobe() roda()
- b0() b0() b0() b0() b1() sobe() roda()
- b1() b1() b1() b1() b1()
- end
- local function letraH()
- b0()
- b1() b0() b0() b0() b1() sobe() roda()
- b1() b0() b0() b0() b1() sobe() roda()
- b1() b1() b1() b1() b1() sobe() roda()
- b1() b0() b0() b0() b1() sobe() roda()
- b1() b0() b0() b0() b1()
- end
- local function letraI()
- b0()
- b1() b1() b1() b1() b1() sobe() roda()
- b0() b0() b1() b0() b0() sobe() roda()
- b0() b0() b1() b0() b0() sobe() roda()
- b0() b0() b1() b0() b0() sobe() roda()
- b1() b1() b1() b1() b1()
- end
- local function letraJ()
- b0()
- b1() b1() b1() b1() b0() sobe() roda()
- b0() b1() b0() b0() b1() sobe() roda()
- b0() b0() b0() b1() b0() sobe() roda()
- b0() b1() b0() b0() b0() sobe() roda()
- b0() b1() b1() b1() b1()
- end
- local function letraK()
- b0()
- b1() b0() b0() b1() b0() sobe() roda()
- b0() b0() b1() b0() b1() sobe() roda()
- b1() b1() b0() b0() b0() sobe() roda()
- b0() b0() b1() b0() b1() sobe() roda()
- b1() b0() b0() b1() b0()
- end
- local function letraL()
- b0()
- b1() b1() b1() b1() b1() sobe() roda()
- b0() b0() b0() b0() b1() sobe() roda()
- b1() b0() b0() b0() b0() sobe() roda()
- b0() b0() b0() b0() b1() sobe() roda()
- b1() b0() b0() b0() b0()
- end
- local function letraM()
- b0()
- b1() b0() b0() b0() b1() sobe() roda()
- b1() b0() b0() b0() b1() sobe() roda()
- b1() b0() b1() b0() b1() sobe() roda()
- b1() b1() b0() b1() b1() sobe() roda()
- b1() b0() b0() b0() b1()
- end
- local function letraN()
- b0()
- b1() b0() b0() b0() b1() sobe() roda()
- b1() b1() b0() b0() b1() sobe() roda()
- b1() b0() b1() b0() b1() sobe() roda()
- b1() b0() b0() b1() b1() sobe() roda()
- b1() b0() b0() b0() b1()
- end
- local function letraO()
- b0()
- b0() b1() b1() b1() b0() sobe() roda()
- b1() b0() b0() b0() b1() sobe() roda()
- b1() b0() b0() b0() b1() sobe() roda()
- b1() b0() b0() b0() b1() sobe() roda()
- b0() b1() b1() b1() b0()
- end
- local function letraP()
- b0()
- b1() b0() b0() b0() b0() sobe() roda()
- b0() b0() b0() b0() b1() sobe() roda()
- b1() b1() b1() b1() b1() sobe() roda()
- b1() b0() b0() b0() b1() sobe() roda()
- b1() b1() b1() b1() b1()
- end
- local function letraQ()
- b0()
- b1() b1() b1() b1() b1() sobe() roda()
- b1() b1() b0() b0() b1() sobe() roda()
- b1() b0() b0() b0() b1() sobe() roda()
- b1() b0() b0() b0() b1() sobe() roda()
- b1() b1() b1() b1() b1()
- end
- local function letraR()
- b0()
- b1() b0() b0() b0() b1() sobe() roda()
- b1() b1() b0() b0() b0() sobe() roda()
- b1() b1() b1() b1() b1() sobe() roda()
- b0() b0() b0() b0() b1() sobe() roda()
- b1() b1() b1() b1() b1()
- end
- local function letraS()
- b0()
- b1() b1() b1() b1() b1() sobe() roda()
- b1() b0() b0() b0() b0() sobe() roda()
- b1() b1() b1() b1() b1() sobe() roda()
- b0() b0() b0() b0() b1() sobe() roda()
- b1() b1() b1() b1() b1()
- end
- local function letraT()
- b0()
- b1() b1() b1() b1() b1() sobe() roda()
- b0() b0() b1() b0() b0() sobe() roda()
- b0() b0() b1() b0() b0() sobe() roda()
- b0() b0() b1() b0() b0() sobe() roda()
- b0() b0() b1() b0() b0()
- end
- local function letraU()
- b0()
- b0() b1() b1() b1() b0() sobe() roda()
- b1() b0() b0() b0() b1() sobe() roda()
- b1() b0() b0() b0() b1() sobe() roda()
- b1() b0() b0() b0() b1() sobe() roda()
- b1() b0() b0() b0() b1()
- end
- local function letraV()
- b0()
- b0() b0() b1() b0() b0() sobe() roda()
- b0() b1() b0() b1() b0() sobe() roda()
- b1() b0() b0() b0() b1() sobe() roda()
- b1() b0() b0() b0() b1() sobe() roda()
- b1() b0() b0() b0() b1()
- end
- local function letraW()
- b0()
- b0() b1() b0() b1() b0() sobe() roda()
- b1() b0() b1() b0() b1() sobe() roda()
- b1() b0() b0() b0() b1() sobe() roda()
- b1() b0() b0() b0() b1() sobe() roda()
- b1() b0() b0() b0() b1()
- end
- local function letraX()
- b0()
- b1() b0() b0() b0() b1() sobe() roda()
- b0() b1() b0() b1() b0() sobe() roda()
- b0() b0() b1() b0() b0() sobe() roda()
- b0() b1() b0() b1() b0() sobe() roda()
- b1() b0() b0() b0() b1()
- end
- local function letraY()
- b0()
- b0() b0() b1() b0() b0() sobe() roda()
- b0() b0() b1() b0() b0() sobe() roda()
- b0() b0() b1() b0() b0() sobe() roda()
- b0() b1() b0() b1() b0() sobe() roda()
- b1() b0() b0() b0() b1()
- end
- local function letraZ()
- b0()
- b1() b1() b1() b1() b1() sobe() roda()
- b0() b0() b0() b1() b0() sobe() roda()
- b0() b0() b1() b0() b0() sobe() roda()
- b0() b1() b0() b0() b0() sobe() roda()
- b1() b1() b1() b1() b1()
- end
- local function apagar()
- turtle.turnRight()
- turtle.turnRight()
- df() df() df() df() df() sai() sobe()
- df() df() df() df() df() sai() sobe()
- df() df() df() df() df() sai() sobe()
- df() df() df() df() df() sai() sobe()
- df() df() df() df() df()
- return2()
- end
- ----------------------------------------------- end of letter functions ----------------------
- local function jump() --2 up 2 down
- turtle.up()
- turtle.up()
- turtle.down()
- turtle.down()
- end
- local function presente() -- gets selected and jumps
- rednet.broadcast("Selecionado!Aguardando Ordens!")
- jump()
- end
- local function oi() -- answers global call
- rednet.broadcast("Letra aguardando, Senhor!")
- end
- local function refuel() -- refuels
- fuel = turtle.getFuelLevel()
- while fuel < 400 do
- turtle.select(1)
- turtle.refuel(1)
- fuel = turtle.getFuelLevel()
- end
- end
- local function chamada2() -- waits for letter
- id,msg4,dist = rednet.receive()
- turtle.select(2)
- if msg4 == "A" then letraA() rednet.broadcast("Letra "..msg4.." pronta, senhor!") return1()
- elseif msg4 == "B" then letraB() rednet.broadcast("Letra "..msg4.." pronta, senhor!") return1()
- elseif msg4 == "C" then letraC() rednet.broadcast("Letra "..msg4.." pronta, senhor!") return1()
- elseif msg4 == "D" then letraD() rednet.broadcast("Letra "..msg4.." pronta, senhor!") return1()
- elseif msg4 == "E" then letraE() rednet.broadcast("Letra "..msg4.." pronta, senhor!") return1()
- elseif msg4 == "F" then letraF() rednet.broadcast("Letra "..msg4.." pronta, senhor!") return1()
- elseif msg4 == "G" then letraG() rednet.broadcast("Letra "..msg4.." pronta, senhor!") return1()
- elseif msg4 == "H" then letraH() rednet.broadcast("Letra "..msg4.." pronta, senhor!") return1()
- elseif msg4 == "I" then letraI() rednet.broadcast("Letra "..msg4.." pronta, senhor!") return1()
- elseif msg4 == "J" then letraJ() rednet.broadcast("Letra "..msg4.." pronta, senhor!") return1()
- elseif msg4 == "K" then letraK() rednet.broadcast("Letra "..msg4.." pronta, senhor!") return1()
- elseif msg4 == "L" then letraL() rednet.broadcast("Letra "..msg4.." pronta, senhor!") return1()
- elseif msg4 == "M" then letraM() rednet.broadcast("Letra "..msg4.." pronta, senhor!") return1()
- elseif msg4 == "N" then letraN() rednet.broadcast("Letra "..msg4.." pronta, senhor!") return1()
- elseif msg4 == "O" then letraO() rednet.broadcast("Letra "..msg4.." pronta, senhor!") return1()
- elseif msg4 == "P" then letraP() rednet.broadcast("Letra "..msg4.." pronta, senhor!") return1()
- elseif msg4 == "Q" then letraQ() rednet.broadcast("Letra "..msg4.." pronta, senhor!") return1()
- elseif msg4 == "R" then letraR() rednet.broadcast("Letra "..msg4.." pronta, senhor!") return1()
- elseif msg4 == "S" then letraS() rednet.broadcast("Letra "..msg4.." pronta, senhor!") return1()
- elseif msg4 == "T" then letraT() rednet.broadcast("Letra "..msg4.." pronta, senhor!") return1()
- elseif msg4 == "U" then letraU() rednet.broadcast("Letra "..msg4.." pronta, senhor!") return1()
- elseif msg4 == "V" then letraV() rednet.broadcast("Letra "..msg4.." pronta, senhor!") return1()
- elseif msg4 == "W" then letraW() rednet.broadcast("Letra "..msg4.." pronta, senhor!") return1()
- elseif msg4 == "X" then letraX() rednet.broadcast("Letra "..msg4.." pronta, senhor!") return1()
- elseif msg4 == "Y" then letraY() rednet.broadcast("Letra "..msg4.." pronta, senhor!") return1()
- elseif msg4 == "Z" then letraZ() rednet.broadcast("Letra "..msg4.." pronta, senhor!") return1()
- elseif msg4 == "Apagar" then apagar() rednet.broadcast("Letra apagada, senhor!")
- end
- end
- local function chamada() -- waits for turtle select or global call
- id,msg,dist = rednet.receive()
- msgn = tonumber(msg)
- if msg == "Respondam!" then
- oi()
- elseif meuid == msgn then
- presente()
- chamada2()
- elseif msg == "TODOS" then
- presente()
- chamada2()
- end
- end
- --Ínicio
- rednet.open("right")
- while true do
- refuel()
- chamada()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement