Guest User

NFSS_GUI

a guest
Feb 14th, 2016
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.80 KB | None | 0 0
  1. yes = window.create(term.current(),5,7,5,5)
  2. no = window.create(term.current(),40,7,5,5)
  3.  
  4. term.setBackgroundColor(colors.white)
  5. yes.setBackgroundColor(colors.gray)
  6. yes.setTextColor(colors.black)
  7. no.setBackgroundColor(colors.gray)
  8. no.setTextColor(colors.black)
  9.  
  10. term.clear()
  11. yes.clear()
  12. no.clear()
  13.  
  14. yes.write("Send")
  15. no.write("Get")
  16.  
  17. while true do
  18. local _,button,x,y = os.pullEvent("mouse_click")
  19. if x > 4 and x < 11 and y > 6 and  y < 14 then
  20. shell.run("clear")
  21. yes.clear()
  22. no.clear()
  23. term.setTextColor(colors.black)
  24. term.setBackgroundColor(colors.white)
  25. term.clear()
  26. print(" ")
  27. print("Your ID: ", os.getComputerID())
  28. term.write("Hostname ")
  29. hostname = read()
  30. term.write("Protocol ")
  31. protocol = read()
  32. term.write("What side is the modem on? ")
  33. modems = tostring(read())
  34. rednet.open(modems)
  35. rednet.host(hostname, protocol)
  36. term.write("What is the file's address ")
  37. fileaddress = read()
  38. term.write("What is the recieving computer's ID ")
  39. a = tonumber(read())
  40. sendfile = fs.open(fileaddress, "r")
  41. sendstr = sendfile.readAll()
  42. rednet.send(a,sendstr)
  43. elseif 40<=x and x<=45 and 7<=y and y<=13 then
  44. no.clear()
  45. yes.clear()
  46.  print(" ")
  47.  term.clear()
  48.  print("Your ID: ", os.getComputerID())
  49.  term.write("What side is your modem on? ")
  50.  modemside = read()
  51.  rednet.open(modemside)
  52.  print("Getting File...")
  53.  local senderID, message, protocol = rednet.receive()
  54.  print("File Grabbed")
  55.  term.clear()
  56.  term.setCursorPos(0,0)
  57.  print("Sender ID = ", senderID)
  58.  print("Protocol = ", protocol)
  59.  sleep(1)
  60.  print("Is This Correct? (y/n) ")
  61.  yn = read()
  62.  if yn == "y" then
  63.  term.write("File Name: ")
  64.  name = read()
  65.  writefile = fs.open(name, "w")
  66.  writefile.write(message)
  67.  writefile.close()
  68.  else
  69.  term.clear()
  70.  term.setCursorPos(0,0)
  71.  print("Sorry that didn't work...")
  72.  end
  73. end
  74. end
Add Comment
Please, Sign In to add comment