Advertisement
Guest User

NetworkC.lua

a guest
Mar 2nd, 2015
272
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.04 KB | None | 0 0
  1. local component = require("component")
  2. local term = require("term")
  3. local shell = require("shell")
  4. local gpu = component.gpu
  5. local modem = component.modem
  6. local computer = component.computer
  7. local w, h = gpu.getResolution()
  8.  
  9. function clear ()
  10.   gpu.fill(0, 0, w, h, " ")
  11.   term.setCursor(1, 1)
  12. end
  13.  
  14. clear()
  15. print("Attempting to establish network connection.")
  16. os.sleep(1)
  17. clear()
  18. print("Attempting to establish network connection..")
  19. os.sleep(1)
  20. clear()
  21. print("Attempting to establish network connection...")
  22. os.sleep(1)
  23. clear()
  24. open = modem.open(113)
  25. if(open == true) then
  26.   computer.beep()
  27.   print("Network connection established")
  28.   os.sleep(2)
  29.   clear()
  30.   shell.execute("AuthServer.lua")
  31. else
  32.     netopen = modem.isOpen(113)
  33.     if(netopen == true) then
  34.       print("Network connection already established!")
  35.       os.sleep(2)
  36.       clear()
  37.       shell.execute("AuthServer.lua")
  38.     else
  39.       computer.beep()
  40.       print("Network connection couldn't be established!")
  41.       os.sleep(1)
  42.       computer.beep()
  43.       os.sleep(1)
  44.       computer.stop(true)
  45. end
  46. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement