ksbd

Server (REC)

Jan 26th, 2013
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.08 KB | None | 0 0
  1. local monitor = 105
  2. local C1, C2, C3, C4, C5, C6, C7, C8 = 22, 23, 24, 25, 31, 30, 29, 28
  3. local C1v, C2v, C3v, C4v, C5v, C6v, C7v, C8v
  4. local compID, value, distance = "nil", "nil", "nil"
  5.  
  6. function netClose()
  7.     rednet.close("right")
  8. end
  9.  
  10. function netOpen()
  11.     netClose()
  12.     rednet.open("right")
  13. end
  14.  
  15. function getData()
  16.     compID, value, distance = rednet.receive()
  17. end
  18.  
  19. function assignData()
  20.     netOpen()
  21.     getData()
  22.     if compID == C1 then
  23.         C1v = value
  24.         print("Computer 1 reports: "..C1v)
  25.     elseif compID == C2 then
  26.         C2v = value
  27.         print("Computer 2 reports: "..C2v)
  28.     elseif compID == C3 then
  29.         C3v = value
  30.         print("Computer 3 reports: "..C3v)
  31.     elseif compID == C4 then
  32.         C4v = value
  33.         print("Computer 4 reports: "..C4v)
  34.     elseif compID == C5 then
  35.         C5v = value
  36.         print("Computer 5 reports: "..C5v)
  37.     elseif compID == C6 then
  38.         C6v = value
  39.         print("Computer 6 reports: "..C6v)
  40.     elseif compID == C7 then
  41.         C7v = value
  42.         print("Computer 7 reports: "..C7v)
  43.     elseif compID == C8 then
  44.         C8v = value
  45.         print("Computer 8 reports: "..C8v)
  46.     end
  47. end
  48.  
  49. while true do assignData() end
Advertisement
Add Comment
Please, Sign In to add comment