Guest User

collectRemoteData

a guest
Mar 14th, 2014
159
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.67 KB | None | 0 0
  1. local args = {...}
  2. local channelList = args
  3. local event, modemSide, senderChannel, replyChannel, message, senderDistance
  4.  
  5. local mon0 = peripheral.wrap("monitor_0")
  6. local modem = peripheral.wrap("left")
  7.  
  8. for k,num in pairs(channelList) do modem.open(tonumber(num)) end
  9.  
  10. while true do
  11.  
  12.   event, modemSide, senderChannel, replyChannel, message, senderDistance = os.pullEvent("modem_message")
  13. --  print(senderDistance)
  14.   local amount = 0
  15.   local cap = -1
  16.   if message.amount then amount = message.amount end
  17.   if message.capacity then cap = message.capacity end
  18.   mon0.clear()
  19.   mon0.setCursorPos(1,1)
  20.   mon0.write("Fractionator 01: ".. (amount/cap*100) .."%")
  21.  
  22. end
Advertisement
Add Comment
Please, Sign In to add comment