Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local modem = peripheral.wrap("left")
- rednet.open("left")
- IDserv = 0
- function split(s, sep)
- local fields = {}
- local sep = sep or " "
- local pattern = string.format("([^%s]+)", sep)
- string.gsub(s, pattern, function(c) fields[#fields + 1] = c end)
- return fields
- end
- print("Bienvenu dans le proggrame client des robot MK1")
- shell.run('clear')
- print("Recheche du serveur ")
- print("Veillez lancer l'étape 1 sur le serveur.")
- while true do
- a,b = rednet.receive()
- if b == "Ping" then
- print("Ping recu")
- rednet.send(a, "Pong")
- print("Confimation envoyé")
- print("En attende d'instruction...")
- IDserv = a
- break
- end
- end
- while true do
- local id = ""
- local name = ""
- event, modemSide, senderChannel, replyChannel, message, senderDistance = os.pullEvent("modem_message")
- print(message)
- RunArg= split(message, ",")
- for i in RunArg do
- print(i)
- end
- if RunArg[0]:lower() == "quarry" then
- local file = io.open( "startup", "w" )
- text = "shell.run(\"rm Quarry)\nshell.run(\"pastebin get 1VvKnTDw Quarry)\nshell.run(\"Quarry,"..RunArg[1] .. ","..RunArg[2].. ","..IDserv..","..senderDistance.."\")"
- file:write(text)
- file:close()
- end
- print(RunArg[0])
- rednet.send(tonumber(id), "Done")
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement