Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local count = 0
- local turtles = {}
- local par1 = ""
- local par2 = ""
- function Register()
- while true do
- id, mes = rednet.receive()
- if mes == "register" then
- known = false
- for i=0, count do
- if turtles[i] == id then
- known = true
- end
- end
- if known == false then
- print("Register: "..id)
- turtles[count] = id
- rednet.send(id, "registerdone")
- count = count + 1
- end
- end
- end
- end
- function SendAll(message)
- for i = 0, count-1 do
- print(turtles[i]..": "..message)
- rednet.send(turtles[i], message)
- end
- end
- function ChechRegisterCount()
- while count == 0 do
- print("No turtles connected")
- sleep(2)
- end
- end
- function Main()
- while true do
- ChechRegisterCount()
- for i=0, 10 do
- SendAll("Place")
- sleep(8)
- SendAll("Pick")
- sleep(5)
- print("Forward...")
- shell.run("Forward")
- end
- end
- end
- rednet.open("right")
- parallel.waitForAny(Register, Main)
- rednet.close("right")
Advertisement
RAW Paste Data
Copied
Advertisement