Advertisement
Maxstripe

gatecontrol

Jul 18th, 2015
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. c = require("component")
  2. e = require("event")
  3. t = require("term")
  4. local m = c.modem
  5.  
  6. s = c.getPrimary("stargate")
  7.  
  8. t.clear()
  9.  
  10. while true do
  11. print(e.pull("sgDialIn"))
  12. print("Incoming Wormhole")
  13. print("Closing Iris")
  14. s.closeIris()
  15. m.open(420) --- Choose whatever port you want
  16. print("Channel Open")
  17. e.pull("sgStargateStateChange")
  18. print("Awaiting Signal")
  19. local _, _, from, port, _, message = e.pull("modem_message")
  20. if message == "12345" then  --- choose whatever password you want
  21.  print("Code Accpeted, Opening Iris")
  22.   s.openIris()
  23.    os.sleep(2)
  24.     m.broadcast(420, "Iris Open") --- port must be the same as the one you chose earlier
  25.      print("Welcome Home")
  26.       os.sleep(10)
  27.        print("Closing Gate")
  28.         s.disconnect()
  29.  else if message ~= "12345" then ---password must be the same as the one you chose earlier
  30.   m.broadcast(420, "Code Rejected") --- port must be the same as the one you chose earlier
  31.    print("Code: " ..(message).." Not Accepted, Disconnecting Gate")
  32.     s.disconnect()
  33.      e.pull("sgStargateStateChange")
  34.       os.sleep(1)
  35.        print("Gate Disconnected, Opening Iris")
  36.         s.openIris()
  37.          print("Good-Bye")
  38.   end
  39.  end
  40. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement