Advertisement
Maxstripe

Iris Control (updated soon)

Aug 9th, 2016
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.24 KB | None | 0 0
  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("Incoming Wormhole")
  12. print("Closing Iris")
  13. s.closeIris()
  14. m.open(420) --- Choose whatever port you want
  15. print("Channel Open")
  16. e.pull("sgStargateStateChange")
  17. print("Awaiting Signal")
  18. local _, _, from, port, _, message = e.pull("modem_message")
  19. if message == "12345" then --- choose whatever password you want
  20. print("Code Accpeted, Opening Iris")
  21. s.openIris()
  22. os.sleep(2)
  23. m.broadcast(420, "Iris Open") --- port must be the same as the one you chose earlier
  24. print("Welcome Home")
  25. os.sleep(10)
  26. print("Locking Up")
  27. s.closeIris()
  28. e.pull("sgStargateStateChange")
  29. os.sleep(1)
  30. s.openIris()
  31. else if message ~= "12345" then ---password must be the same as the one you chose earlier
  32. m.broadcast(420, "Code Rejected") --- port must be the same as the one you chose earlier
  33. print("Code: " ..(message).." Not Accepted, Locking Up Gate")
  34. s.closeIris()
  35. e.pull("sgStargateStateChange")
  36. os.sleep(1)
  37. print("Gate Disconnected, Opening Iris")
  38. s.openIris()
  39. print("Good-Bye")
  40. end
  41. end
  42. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement