Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- yes = window.create(term.current(),5,7,5,5)
- no = window.create(term.current(),40,7,5,5)
- term.setBackgroundColor(colors.white)
- yes.setBackgroundColor(colors.gray)
- yes.setTextColor(colors.black)
- no.setBackgroundColor(colors.gray)
- no.setTextColor(colors.black)
- term.clear()
- yes.clear()
- no.clear()
- yes.write("Send")
- no.write("Get")
- while true do
- local _,button,x,y = os.pullEvent("mouse_click")
- if x > 4 and x < 11 and y > 6 and y < 14 then
- shell.run("clear")
- yes.clear()
- no.clear()
- term.setTextColor(colors.black)
- term.setBackgroundColor(colors.white)
- term.clear()
- print(" ")
- print("Your ID: ", os.getComputerID())
- term.write("Hostname ")
- hostname = read()
- term.write("Protocol ")
- protocol = read()
- term.write("What side is the modem on? ")
- modems = tostring(read())
- rednet.open(modems)
- rednet.host(hostname, protocol)
- term.write("What is the file's address ")
- fileaddress = read()
- term.write("What is the recieving computer's ID ")
- a = tonumber(read())
- sendfile = fs.open(fileaddress, "r")
- sendstr = sendfile.readAll()
- rednet.send(a,sendstr)
- elseif 40<=x and x<=45 and 7<=y and y<=13 then
- no.clear()
- yes.clear()
- print(" ")
- term.clear()
- print("Your ID: ", os.getComputerID())
- term.write("What side is your modem on? ")
- modemside = read()
- rednet.open(modemside)
- print("Getting File...")
- local senderID, message, protocol = rednet.receive()
- print("File Grabbed")
- term.clear()
- term.setCursorPos(0,0)
- print("Sender ID = ", senderID)
- print("Protocol = ", protocol)
- sleep(1)
- print("Is This Correct? (y/n) ")
- yn = read()
- if yn == "y" then
- term.write("File Name: ")
- name = read()
- writefile = fs.open(name, "w")
- writefile.write(message)
- writefile.close()
- else
- term.clear()
- term.setCursorPos(0,0)
- print("Sorry that didn't work...")
- end
- end
- end
Add Comment
Please, Sign In to add comment