Advertisement
charlesthepenguin

startmessage2

Jul 27th, 2020
33
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.28 KB | None | 0 0
  1. local c = require("component")
  2. local term = require("term")
  3. local component = require("component")
  4. local event = require("event")
  5. local serialization = require("serialization")
  6. local gpu = component.gpu
  7. local w, h = gpu.getResolution()
  8. gpu.fill(1, 1, w, h, " ")
  9. local modem = c.modem
  10. local asd = 1
  11. local port = 123
  12. local os = require("os")
  13.  
  14. local address
  15. repeat
  16. term.clear(true)
  17. print("SGC Dialing Computer")
  18. print("")
  19. print("Which Gate do you want to connect to? (Number only)")
  20. print("1. Spawn")
  21. print("2. Nether")
  22. print("3. Alpha site")
  23. print("4. SHUTDOWN GATE!")
  24. print("5. I wanna charge the alpha site.")
  25. print("6. I want to type my adress manually")
  26. num = io.read()
  27. print()
  28. if num == "1" then
  29. print("Dialing Spawn.")
  30. modem.broadcast(port, "dial1")
  31. print("Address sent to gate computer.")
  32. os.sleep(5)
  33.  
  34.  
  35.  
  36. elseif num == "2" then
  37. print("Dialing Neather.")
  38. modem.broadcast(port, "dial2", address, 9)
  39. print("Address sent to gate computer.")
  40. os.sleep(5)
  41.  
  42. elseif num == "3" then
  43. print("Dialing Alpha Site.")
  44. modem.broadcast(port, "dial3", address, 9)
  45. print("Address sent to gate computer.")
  46. os.sleep(5)
  47.  
  48.  
  49. elseif num == "4" then
  50. print("Gate Shutdown Issued!")
  51. modem.broadcast(port, "sd", address, 9)
  52. print("Shutdown command sent.")
  53. os.sleep(5)
  54.  
  55. elseif num == "5" then
  56. print("Dialing Alpha Site and engaging power beam.")
  57. print("Select how long the power beam will be active")
  58. print("1,2,3,4 or 5 minutes")
  59. print("1 minute = 20 million RF")
  60. num = io.read()
  61. print()
  62. if num == "1" then
  63. modem.broadcast(port, "charge1", address, 9)
  64. print("Sending Power for 1 Minute.")
  65.  
  66. elseif num == "2" then
  67. modem.broadcast(port, "charge2", address, 9)
  68. print("Sending Power for 2 Minutes.")
  69. elseif num == "3" then
  70. modem.broadcast(port, "charge3", address, 9)
  71. print("Sending Power for 3 Minutes.")
  72. elseif num == "4" then
  73. modem.broadcast(port, "charge4", address, 9)
  74. print("Sending Power for 4 Minutes.")
  75. elseif num == "5" then
  76. modem.broadcast(port, "charge5", address, 9)
  77. print("Sending Power for 5 Minutes.")
  78. elseif num ~= "1" or num ~= "2" or num ~= "3" or num ~= "4" or num ~= "5" then
  79. print("ERROR: Wrong number typed!")
  80. else
  81. print("UNKNOWN ERROR")
  82. end
  83. os.sleep(5)
  84.  
  85.  
  86. elseif num == "6" then
  87. print("How many symbols do you want to dial?(7/8/9)")
  88. num = io.read()
  89. print()
  90. if num == "7" then
  91. print("The program will require 6 symbols from you (7th symbol is automatic). Start typing now.")
  92. print("Symbol 1")
  93. chev1 = io.read()
  94. print("Symbol 2")
  95. chev2 = io.read()
  96. print("Symbol 3")
  97. chev3 = io.read()
  98. print("Symbol 4")
  99. chev4 = io.read()
  100. print("Symbol 5")
  101. chev5 = io.read()
  102. print("Symbol 6")
  103. chev6 = io.read()
  104. chev7 = "Point of Origin"
  105. if chev1 == chev2 or chev1 == chev3 or chev1 == chev4 or chev1 == chev6 or chev1 == chev7 or chev2 == chev3 or chev2 == chev4 or
  106. chev2 == chev6 or chev2 == chev7 or chev3 == chev4 or chev3 == chev5 or chev3 == chev6 or chev3 == chev7 or chev4 == chev5 or chev4 == chev6
  107. or chev4 == chev7 or chev5 == chev6 or chev5 == chev7 or chev6 == chev7 then
  108. print("ERROR: Two symbols are the same")
  109. else
  110. address_raw = {chev1, chev2, chev3, chev4, chev5, chev6, chev7}
  111. print()
  112. print("Confirm address: ".. chev1 ..", ".. chev2 ..", ".. chev3 ..", ".. chev4 ..", ".. chev5 ..", ".. chev6 ..", ".. chev7 .." (y/n)")
  113. local answer = io.read()
  114. if answer == "y" then
  115. address = serialization.serialize(address_raw)
  116. modem.broadcast(port, "manual", address)
  117. print("Address sent to gate computer.")
  118. else
  119. print("Dialing Aborted")
  120. os.sleep(5)
  121.  
  122. end
  123. end
  124. elseif num == "8" then
  125. print("The program will require 7 symbols from you (8th symbol is automatic). Write the symbols' full names.")
  126. print("Symbol 1")
  127. chev1 = io.read()
  128. print("Symbol 2")
  129. chev2 = io.read()
  130. print("Symbol 3")
  131. chev3 = io.read()
  132. print("Symbol 4")
  133. chev4 = io.read()
  134. print("Symbol 5")
  135. chev5 = io.read()
  136. print("Symbol 6")
  137. chev6 = io.read()
  138. print("Symbol 7")
  139. chev7 = io.read()
  140. chev8 = "Point of Origin"
  141. if chev1 == chev2 or chev1 == chev3 or chev1 == chev4 or chev1 == chev6 or chev1 == chev7 or chev1 == chev8 or chev2 == chev3 or chev2 ==
  142. chev4 or chev2 == chev6 or chev2 == chev7 or chev2 == chev8 or chev3 == chev4 or chev3 == chev5 or chev3 == chev6 or chev3 == chev7 or chev3
  143. == chev8 or chev4 == chev5 or chev4 == chev6 or chev4 == chev7 or chev4 == chev8 or chev5 == chev6 or chev5 == chev7 or chev5 == chev8 or
  144. chev6 == chev7 or chev6 == chev8 or chev7 == chev8 then
  145. print("ERROR: Two symbols are the same")
  146. else
  147. address_raw = {chev1, chev2, chev3, chev4, chev5, chev6, chev7, chev8}
  148. print()
  149. print("Confirm address: ".. chev1 ..", ".. chev2 ..", ".. chev3 ..", ".. chev4 ..", ".. chev5 ..", ".. chev6 ..", ".. chev7 ..", ".. chev8 .." (y/n)")
  150. local answer = io.read()
  151. if answer == "y" then
  152. address = serialization.serialize(address_raw)
  153. modem.broadcast(port, "manual", address)
  154. print("Address sent to gate computer.")
  155. else
  156. print("Dialing Aborted")
  157. os.sleep(5)
  158.  
  159. end
  160. end
  161. elseif num == "9" then
  162. print("The program will require 8 symbols from you (9th symbol is automatic). Start typing now.")
  163. print("Symbol 1")
  164. chev1 = io.read()
  165. print("Symbol 2")
  166. chev2 = io.read()
  167. print("Symbol 3")
  168. chev3 = io.read()
  169. print("Symbol 4")
  170. chev4 = io.read()
  171. print("Symbol 5")
  172. chev5 = io.read()
  173. print("Symbol 6")
  174. chev6 = io.read()
  175. print("Symbol 7")
  176. chev7 = io.read()
  177. print("Symbol 8")
  178. chev8 = io.read()
  179. chev9 = "Point of Origin"
  180. if chev1 == chev2 or chev1 == chev3 or chev1 == chev4 or chev1 == chev6 or chev1 == chev7 or chev1 == chev8 or chev1 == chev9 or
  181. chev2 == chev3 or chev2 == chev4 or chev2 == chev6 or chev2 == chev7 or chev2 == chev8 or chev2 == chev9 or chev3 == chev4 or chev3 == chev5
  182. or chev3 == chev6 or chev3 == chev7 or chev3 == chev8 or chev3 == chev9 or chev4 == chev5 or chev4 == chev6 or chev4 == chev7 or chev4 ==
  183. chev8 or chev4 == chev9 or chev5 == chev6 or chev5 == chev7 or chev5 == chev8 or chev5 == chev9 or chev6 == chev7 or chev6 == chev8 or chev6
  184. == chev9 or chev7 == chev8 or chev7 == chev9 or chev8 == chev9 then
  185. print("ERROR: Two symbols are the same")
  186. else
  187.  
  188. address_raw = {chev1, chev2, chev3, chev4, chev5, chev6, chev7, chev8, chev9}
  189. print()
  190. print("Confirm address: ".. chev1 ..", ".. chev2 ..", ".. chev3 ..", ".. chev4 ..", ".. chev5 ..", ".. chev6 ..", ".. chev7 ..", "..
  191. chev8 ..", ".. chev9 .." (y/n)")
  192. local answer = io.read()
  193. if answer == "y" then
  194. address = serialization.serialize(address_raw)
  195. modem.broadcast(port, "manual", address, 9)
  196. print("Address sent to gate computer.")
  197. else
  198. print("Dialing Aborted")
  199. os.sleep(5)
  200.  
  201. end
  202. end
  203. elseif num ~= "9" or num ~= "8" or num ~= "7" then
  204. print("ERROR: number is not 7 or 8")
  205. else
  206. print("UNKNOWN ERROR")
  207. end
  208.  
  209.  
  210.  
  211. os.sleep(5)
  212.  
  213. elseif num ~= "1" or num ~= "2" or num ~= "3" or num ~= "4" or num ~= "5" or num ~= "6" then
  214. print("ERROR: Wrong number typed!")
  215. os.sleep(5)
  216.  
  217. else
  218. print("UNKNOWN ERROR")
  219. os.sleep(5)
  220. end
  221. until asd == 2
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement