SHARE
TWEET

Untitled

a guest Sep 20th, 2019 91 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. fs.makeDir("SpawnControl")
  2.  
  3. local function istable(t) return type(t) == 'table' end
  4.  
  5. function save_config(a,b,c)
  6.     sw = fs.open("config.txt", "w")  
  7.     sw.writeLine(a)
  8.     sw.writeLine(b)
  9.     sw.writeLine(c)
  10.     sw.close()
  11. end
  12.  
  13. local Connecting = true
  14. local Port = 6572
  15.  
  16. local Modem = peripheral.wrap("top")
  17. Modem.open(Port)
  18.  
  19. Modem.transmit(6571, Port, "Connect")
  20.  
  21. while Connecting == true do
  22.    
  23.     local event, modemSide, senderChannel, replyChannel, message, senderDistance = os.pullEvent("modem_message")
  24.         if istable(message) then
  25.             local info = message
  26.             local port = info.Port
  27.             local mtype = info.MobType
  28.             local bl  = 0
  29.             save_config(port,mobtype,bl)
  30.             Modem.transmit(port, Port, "Success")
  31.             print("saved "..mtype)
  32.         end
  33.  
  34.     print("more Modems? y/n")
  35.  
  36.     if read() == "n" then
  37.         Connecting = false
  38.     end
  39.  
  40. end
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top