Advertisement
Aixler

slaveTank

Nov 4th, 2013
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.64 KB | None | 0 0
  1. --Set params
  2. tankSide = "bottom"
  3. modemSide = "right"
  4. monitorID = 52
  5.  
  6. tank = peripheral.wrap(tankSide)
  7. rednet.open(modemSide)
  8.  
  9. name = "empty"
  10.  
  11. function main()
  12.     amount = 1
  13.     id, msg, distance, tableinfo, results = nil, nil, nil, nil, nil
  14.     id, msg, distance = rednet.receive()
  15.     if id == monitorID then
  16.         tableinfo = tank.getTankInfo("bottom")
  17.         results = tableinfo[1]
  18.         sleep(1)
  19.         if results["amount"] ~= nil then
  20.             amount = results["amount"]
  21.         end
  22.         if results["name"] ~= nil then
  23.             name = results["name"]
  24.         end
  25.         rednet.send(monitorID, name.." "..amount.." "..results["capacity"])
  26.     end
  27. end
  28.  
  29. while true do
  30.     main()
  31.     sleep(2)
  32. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement