Advertisement
9551

Untitled

Jul 1st, 2021
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.60 KB | None | 0 0
  1. local arg = {...}
  2. batC = arg[2]
  3. batCN = tonumber(batC)
  4. x = 0
  5.  
  6. net1 = arg[4]
  7. net2 = arg[5]
  8. net3 = arg[6]
  9. net4 = arg[7]
  10. net5 = arg[8]
  11.  
  12. rednet.open(arg[1])
  13.  
  14. local function getSe(net)
  15.     local BAT = peripheral.wrap(net)
  16.     local char = BAT.getEUStored()
  17.     return char
  18. end
  19.  
  20. local function calc(enableVal, nets)
  21.     if batCN > enableVal then
  22.         x = x + getSe(nets)
  23.     end
  24. end
  25.  
  26. while true do
  27.    
  28.     calc(0, net1)
  29.     calc(1, net2)
  30.     calc(2, net3)
  31.     calc(3, net4)
  32.     calc(4, net5)
  33.    
  34.     rednet.send(tonumber(arg[3]), x)
  35.     print(x)
  36.     x = 0
  37. end
  38.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement