charlesthepenguin

startdial

Jul 26th, 2020
9
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. c = require("component")
  2. local term = require("term")
  3. local component = require("component")
  4. event = require("event")
  5. os = require("os")
  6. event = require("event")
  7. computer = require("computer")
  8. serialization = require("serialization")
  9. local gpu = component.gpu -- get primary gpu component
  10. local w, h = gpu.getResolution()
  11. gpu.fill(1, 1, w, h, " ") -- clears the screen
  12. sg = c.stargate
  13. modem = c.modem
  14. port = 123
  15. local asd = 1
  16. print("SGC Gate Computer")
  17. print("--------------------------------------------------------------------------------------------------------------------------------------------------------------")
  18. print()
  19.  
  20. repeat
  21. term.clear(true)
  22. modem.open(port)
  23. print("Port opened. Listening for incoming messages and events")
  24. print()
  25.  
  26. local _, _, _, _, _, raw, address_raw = event.pull(nil, "modem_message")
  27. modem.close(port)
  28. print("Message recieved.")
  29. os.sleep(0.5)
  30.  
  31. if raw == "sd" then
  32. print("Attempting to shut down wormhole")
  33. os.sleep(0.7)
  34. sg.disengageGate()
  35. elseif raw == "dial1" then
  36. print()
  37. address = {"Sextans", "Corona Australis", "Andromeda", "Perseus", "Leo", "Aries", "Point of Origin"}
  38. os.sleep(0.5)
  39. print("Dialing")
  40. for i,v in ipairs(address) do print(i,v) end
  41. print()
  42.  
  43. function dialNext(dialed)
  44. glyph = address[dialed + 1]
  45. print("Engaging "..glyph.."... ")
  46.  
  47. sg.engageSymbol(glyph)
  48. end
  49.  
  50. eventID = event.listen("stargate_spin_chevron_engaged", function(evname, address, caller, num, lock, glyph)
  51. os.sleep(2)
  52.  
  53. if lock then
  54. if (event.cancel(eventID)) then
  55. print("Event cancelled successfully")
  56. end
  57.  
  58. os.sleep(2)
  59.  
  60. print("Engaging...")
  61. sg.engageGate()
  62. doing = false
  63. os.sleep(5) print("30")
  64. os.sleep(1) print("29")
  65. os.sleep(1) print("28")
  66. os.sleep(1) print("27")
  67. os.sleep(1) print("26")
  68. os.sleep(1) print("25")
  69. os.sleep(1) print("24")
  70. os.sleep(1) print("23")
  71. os.sleep(1) print("22")
  72. os.sleep(1) print("21")
  73. os.sleep(1) print("20")
  74. os.sleep(1) print("19")
  75. os.sleep(1) print("18")
  76. os.sleep(1) print("17")
  77. os.sleep(1) print("16")
  78. os.sleep(1) print("15")
  79. os.sleep(1) print("14")
  80. os.sleep(1) print("13")
  81. os.sleep(1) print("12")
  82. os.sleep(1) print("11")
  83. os.sleep(1) print("10")
  84. os.sleep(1) print("9")
  85. os.sleep(1) print("8")
  86. os.sleep(1) print("7")
  87. os.sleep(1) print("6")
  88. os.sleep(1) print("5")
  89. os.sleep(1) print("4")
  90. os.sleep(1) print("3")
  91. os.sleep(1) print("2")
  92. os.sleep(1) print("1")
  93. os.sleep(1) print("Stargate Shutdown")
  94. sg.disengageGate()
  95. os.sleep(1)
  96. else
  97. dialNext(num)
  98. end
  99. end)
  100.  
  101. dialNext(0)
  102. doing = true
  103. print()
  104. while doing do os.sleep(0.1) end
  105.  
  106. elseif raw == "dial2" then
  107. print()
  108. address = {"Sextans", "Corona Australis", "Andromeda", "Perseus", "Leo", "Aries", "Point of Origin"}
  109. os.sleep(0.5)
  110. print("Dialing")
  111. for i,v in ipairs(address) do print(i,v) end
  112. print()
  113.  
  114. function dialNext(dialed)
  115. glyph = address[dialed + 1]
  116. print("Engaging "..glyph.."... ")
  117.  
  118. sg.engageSymbol(glyph)
  119. end
  120.  
  121. eventID = event.listen("stargate_spin_chevron_engaged", function(evname, address, caller, num, lock, glyph)
  122. os.sleep(2)
  123.  
  124. if lock then
  125. if (event.cancel(eventID)) then
  126. print("Event cancelled successfully")
  127. end
  128.  
  129. os.sleep(2)
  130.  
  131. print("Engaging...")
  132. sg.engageGate()
  133.  
  134. doing = false
  135. modem.open(port)
  136.  
  137. os.sleep(5) print("30")
  138. os.sleep(1) print("29")
  139. os.sleep(1) print("28")
  140. os.sleep(1) print("27")
  141. os.sleep(1) print("26")
  142. os.sleep(1) print("25")
  143. os.sleep(1) print("24")
  144. os.sleep(1) print("23")
  145. os.sleep(1) print("22")
  146. os.sleep(1) print("21")
  147. os.sleep(1) print("20")
  148. os.sleep(1) print("19")
  149. os.sleep(1) print("18")
  150. os.sleep(1) print("17")
  151. os.sleep(1) print("16")
  152. os.sleep(1) print("15")
  153. os.sleep(1) print("14")
  154. os.sleep(1) print("13")
  155. os.sleep(1) print("12")
  156. os.sleep(1) print("11")
  157. os.sleep(1) print("10")
  158. os.sleep(1) print("9")
  159. os.sleep(1) print("8")
  160. os.sleep(1) print("7")
  161. os.sleep(1) print("6")
  162. os.sleep(1) print("5")
  163. os.sleep(1) print("4")
  164. os.sleep(1) print("3")
  165. os.sleep(1) print("2")
  166. os.sleep(1) print("1")
  167. os.sleep(1) print("Stargate Shutdown")
  168. sg.disengageGate()
  169. os.sleep(1)
  170. else
  171. dialNext(num)
  172. end
  173. end)
  174.  
  175. dialNext(0)
  176. doing = true
  177. print()
  178. while doing do os.sleep(0.1) end
  179.  
  180. elseif raw == "manual" then
  181. local address = serialization.unserialize(address_raw)
  182. print()
  183. os.sleep(0.5)
  184. print("Dialing")
  185. for i,v in ipairs(address) do print(i,v) end
  186. print()
  187.  
  188. function dialNext(dialed)
  189. glyph = address[dialed + 1]
  190. print("Engaging "..glyph.."... ")
  191.  
  192. sg.engageSymbol(glyph)
  193. end
  194.  
  195. eventID = event.listen("stargate_spin_chevron_engaged", function(evname, address, caller, num, lock, glyph)
  196. os.sleep(2)
  197.  
  198. if lock then
  199. if (event.cancel(eventID)) then
  200. print("Event cancelled successfully")
  201. end
  202.  
  203. os.sleep(2)
  204.  
  205. print("Engaging...")
  206. sg.engageGate()
  207. os.sleep(5) print("30")
  208. os.sleep(1) print("29")
  209. os.sleep(1) print("28")
  210. os.sleep(1) print("27")
  211. os.sleep(1) print("26")
  212. os.sleep(1) print("25")
  213. os.sleep(1) print("24")
  214. os.sleep(1) print("23")
  215. os.sleep(1) print("22")
  216. os.sleep(1) print("21")
  217. os.sleep(1) print("20")
  218. os.sleep(1) print("19")
  219. os.sleep(1) print("18")
  220. os.sleep(1) print("17")
  221. os.sleep(1) print("16")
  222. os.sleep(1) print("15")
  223. os.sleep(1) print("14")
  224. os.sleep(1) print("13")
  225. os.sleep(1) print("12")
  226. os.sleep(1) print("11")
  227. os.sleep(1) print("10")
  228. os.sleep(1) print("9")
  229. os.sleep(1) print("8")
  230. os.sleep(1) print("7")
  231. os.sleep(1) print("6")
  232. os.sleep(1) print("5")
  233. os.sleep(1) print("4")
  234. os.sleep(1) print("3")
  235. os.sleep(1) print("2")
  236. os.sleep(1) print("1")
  237. os.sleep(1) print("Stargate Shutdown")
  238. sg.disengageGate()
  239. os.sleep(1)
  240.  
  241. doing = false
  242. else
  243. dialNext(num)
  244. end
  245. end)
  246.  
  247. dialNext(0)
  248. doing = true
  249. print()
  250. while doing do os.sleep(0.1) end
  251. end
  252. until asd == 2
RAW Paste Data