Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local modem = peripheral.wrap("right")
- print("Proggrame Serveur des robot MK1")
- sleep(0.5)
- robotlist = {}
- function AddRobot()
- print("Fonction d'ajout de robot :")
- print("---------------------------------------")
- turtleid = ""
- while turtleid == "" do
- shell.run('clear')
- print("Saisir l'id de la tortue...")
- local id = tonumber(string.match(read(), "%d*"))
- rednet.send(id, "Ping")
- print("Ping de la tortue (10s max)")
- local rip,rmessage = rednet.receive(10)
- if rmessage == "Pong" then
- turtleid = id
- shell.run('clear')
- local robot = {id,"neutre","",0}
- table.insert(robotlist, robot)
- print("Robot confirmé")
- sleep(1.5)
- break
- end
- printError("Aucune réponse de la tortue")
- printError("Vérifier l'id")
- print()
- print("Appuyer sur une touche pour continuer.")
- sleep(2)
- end
- shell.run('clear')
- print("Configuration du robot:")
- print("---------------------------------------")
- print("Fonction disponible:")
- print("Quarry:")
- local result = ""
- while result ~= "quarry" do
- result = read():lower()
- if result == "quarry" then
- shell.run('clear')
- print("Configuration de la quarry")
- print("---------------------------------------")
- print("Saisir la largeur :")
- local largeur = read()
- print("Saisir la longueur :")
- local longueur = read()
- rednet.send(turtleid, "Quarry,"..largeur..","..longueur)
- end
- end
- end
- function CheckRobot(i)
- id,status,info,fuel = i
- print("Traitement du robot n°" .. id .. " en cours")
- print("Envoie du ping; timeout 30s...")
- rednet.send(id, "status")
- if rednet.receive(10) == "nil" then
- print("Un erreur a eux lieux avec le robot ")
- end
- end
- AddRobot()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement