MrHG

CCSender

Jun 2nd, 2020
1,451
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.67 KB | None | 0 0
  1. local sides = { "top", "bottom", "left", "right",
  2. "front", "back" }
  3. local modemSide = "back";
  4. local protocol = "remoteT";
  5. for i = 1, #sides do
  6.   if peripheral.isPresent(sides[i]) then
  7.     if peripheral.getType(sides[i]) == "modem" then
  8.       print("Modem found.");
  9.       modemSide = sides[i];
  10.       rednet.open(modemSide);
  11.       break
  12.     end
  13.   end
  14. end
  15. if rednet.isOpen(modemSide) then
  16.   listeners = {rednet.lookup(protocol)};
  17.   print("Found "..#listeners.." Listeners");
  18.   term.write("Input Command: ");
  19.   local command = read();
  20.   rednet.broadcast(command,protocol);
  21.   print("Successfully sent command.");
  22. else
  23.   print("No modem found.");
  24.   return
  25. end
Advertisement
Add Comment
Please, Sign In to add comment