Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function PP2Receive(packetwait)
- mastID, PP2Packet = rednet.receive("PP2", packetwait)
- sep = "%s"
- t = {}
- i = 1
- for str in string.gmatch(PP2Packet, "([^"..sep.."]+)") do
- t[i] = str
- i = i + 1
- end
- pp2S = #t
- t[1] = tonumber(t[1])
- t[2] = tonumber(t[2])
- if pp2S == 3 then
- return t[1], t[2], t[3]
- end
- outputMessage = ""
- counter = 3
- while counter <= pp2S do
- outputMessage = outputMessage .. t[counter] .. " "
- counter = counter + 1
- end
- return t[1], t[2], outputMessage
- end
- while true do
- local message = ""
- i1, i2, message = PP2Receive()
- if message == "track" then
- rs.setOutput(left, false)
- message = ""
- i1, i2, message = PP2Receive()
- if message == "track" then
- rs.setOutput(left, true)
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement