Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local derpy={}
- local function open()
- for k,v in pairs(rs.getSides()) do
- if peripheral.getType(v) == "modem" then rednet.open(v) return true end
- end
- return false
- end
- if not open() then error("Needs modem") end
- term.clear()
- while true do
- term.setCursorPos(1,1)
- term.clearLine()
- print("What Computer ID would you like to connect to?")
- write("ID> ")
- id = tonumber(read())
- derpy.id=id
- if id then print("ID is "..id) break end
- print("Invalid ID.")
- sleep(3)
- term.setCursorPos(2,1)
- term.clearLine()
- term.setCursorPos(3,1)
- term.clearLine()
- end
- print("What password does ID #"..id.." have?")
- write("Password: ")
- local pass = read()
- rednet.send(tonumber(id), pass)
- repeat
- local i,msg = rednet.receive(3)
- until i == id or i == nil
- print("")
- write("Trying to connect in 3..")
- sleep(1)
- write("2..")
- sleep(1)
- write("1..")
- sleep(1)
- term.clear()
- term.setCursorPos(1,1)
- local function listen()
- while true do
- e,s = rednet.receive()
- if e == tonumber(derpy.id) then
- if s == "done" then
- term.clear()
- term.setCursorPos(1,1)
- print("End of broadcast!")
- return
- end
- local ok, err = pcall(loadstring(s))
- if not ok then
- print("Unexpected error: "..err.."!")
- return
- end
- end
- end
- end
- listen()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement