Advertisement
ksbd

Redstone Energy Cell Auto-Refuel

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