Advertisement
Guest User

Untitled

a guest
Mar 16th, 2017
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.88 KB | None | 0 0
  1. on the receive Computer
  2.  
  3. --Ouverture des ports du modem
  4. modem.open(1001) -- energie de la batterie sur terre
  5. modem.open(1002) -- energie de la batterie spatiale
  6.  
  7. --Main
  8. local function onModem(_,_,from,port,_,IDcode,message)
  9. if IDcode == "espace" then
  10. energie_espace = serialization.unserialize(message)
  11. afflevel(2,28,61,energie_espace,"SPATIALE")
  12. elseif IDcode == "terre" then
  13. energie_terre = serialization.unserialize(message)
  14. afflevel(2,32,61,energie_terre,"TERIENNE")
  15. end
  16. end
  17.  
  18. local function onModem(_,_,from,port,_,IDcode,message)
  19. if IDcode == "terre" then
  20. energie_terre = serialization.unserialize(message)
  21. afflevel(2,32,61,energie_terre,"TERIENNE")
  22. end
  23. end
  24.  
  25.  
  26.  
  27.  
  28. on the send computer 1
  29.  
  30. IDcode = "terre"
  31. modem.broadcast(port, IDcode, "data")
  32.  
  33.  
  34.  
  35.  
  36. on the send computer 2
  37.  
  38. IDcode = "espace"
  39. modem.broadcast(port, IDcode, "data")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement