Advertisement
Guest User

Untitled

a guest
Mar 23rd, 2017
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 KB | None | 0 0
  1. function PP2Receive(packetwait)
  2. mastID, PP2Packet = rednet.receive("PP2", packetwait)
  3. sep = "%s"
  4. t = {}
  5. i = 1
  6. for str in string.gmatch(PP2Packet, "([^"..sep.."]+)") do
  7. t[i] = str
  8. i = i + 1
  9. end
  10. pp2S = #t
  11. t[1] = tonumber(t[1])
  12. t[2] = tonumber(t[2])
  13.  
  14. if pp2S == 3 then
  15. return t[1], t[2], t[3]
  16. end
  17. outputMessage = ""
  18. counter = 3
  19. while counter <= pp2S do
  20. outputMessage = outputMessage .. t[counter] .. " "
  21. counter = counter + 1
  22. end
  23. return t[1], t[2], outputMessage
  24. end
  25.  
  26. while true do
  27. local message = ""
  28. i1, i2, message = PP2Receive()
  29. if message == "track" then
  30. rs.setOutput(left, false)
  31. message = ""
  32. i1, i2, message = PP2Receive()
  33. if message == "track" then
  34. rs.setOutput(left, true)
  35. end
  36. end
  37. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement