Guest User

Untitled

a guest
Jul 26th, 2020
8
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. c = require("component")
  2. event = require("event")
  3. os = require("os")
  4. event = require("event")
  5. computer = require("computer")
  6. serialization = require("serialization")
  7. sg = c.stargate
  8. modem = c.modem
  9. port = 123
  10. local asd = 1
  11. print("Stargate controller")
  12. print("--------------------------------------------------------------------------------------------------------------------------------------------------------------")
  13. print()
  14.  
  15. repeat
  16.   modem.open(port)
  17.   print("Port opened. Listening for incoming messages and events")
  18.   print()
  19.  
  20.   local _, _, _, _, _, raw, address_raw = event.pull(nil, "modem_message")
  21.   modem.close(port)
  22.   print("Message recieved.")
  23.   os.sleep(0.5)
  24.  
  25.   if raw == "sd" then
  26.     local address = serialization.unserialize(address_raw)
  27.     print("Attempting to shut down wormhole")
  28.     os.sleep(0.7)
  29.     sg.disengageGate()
  30.   elseif raw == "dial1" then
  31.     local address = serialization.unserialize(address_raw)
  32.     os.sleep(0.5)
  33.     print("Dialing Spawn")
  34.     print()
  35.     address = {"Sextans", "Corona Australis", "Andromeda", "Perseus", "Leo", "Aries", "Point of Origin"}
  36.     for i,v in ipairs(address) do print(i,v) end
  37.     print()
  38.     function dialNext(dialed)
  39.       glyph = address[dialed + 1]
  40.       print("Engaging "..glyph.."... ")
  41.  
  42.       sg.engageSymbol(glyph)
  43.     end
  44.   end
  45.   eventID = event.listen("stargate_spin_chevron_engaged"),  function(evname, address, caller, num, lock, glyph)
  46.     os.sleep(2)
  47.  
  48.     if lock then
  49.       if (event.cancel(eventID)) then
  50.         print("Event cancelled successfully")
  51.       end
  52.       os.sleep(0.1)
  53.  
  54.       print("Engaging...")
  55.       sg.engageGate()
  56.  
  57.       doing = false
  58.       os.sleep(5) print("30")
  59.       os.sleep(1) print("29")
  60.       os.sleep(1) print("28")
  61.       os.sleep(1) print("27")
  62.       os.sleep(1) print("26")
  63.       os.sleep(1) print("25")
  64.       os.sleep(1) print("24")
  65.       os.sleep(1) print("23")
  66.       os.sleep(1) print("22")
  67.       os.sleep(1) print("21")
  68.       os.sleep(1) print("20")
  69.       os.sleep(1) print("19")
  70.       os.sleep(1) print("18")
  71.       os.sleep(1) print("17")
  72.       os.sleep(1) print("16")
  73.       os.sleep(1) print("15")
  74.       os.sleep(1) print("14")
  75.       os.sleep(1) print("13")
  76.       os.sleep(1) print("12")
  77.       os.sleep(1) print("11")
  78.       os.sleep(1) print("10")
  79.       os.sleep(1) print("9")
  80.       os.sleep(1) print("8")
  81.       os.sleep(1) print("7")
  82.       os.sleep(1) print("6")
  83.       os.sleep(1) print("5")
  84.       os.sleep(1) print("4")
  85.       os.sleep(1) print("3")
  86.       os.sleep(1) print("2")
  87.       os.sleep(1) print("1")
  88.       os.sleep(1) print("Stargate Shutdown")
  89.  
  90.       sg.disengageGate()
  91.       os.sleep(1)
  92.       computer.shutdown(true)
  93.     else
  94.       dialNext(num)
  95.     end
  96.   end
  97. elseif raw == "dial2" then
  98.   os.sleep(0.5)
  99.   print("Dialing Neather")
  100.   print()
  101.   address = {"Sextans", "Corona Australis", "Andromeda", "Perseus", "Leo", "Aries", "Point of Origin"}
  102.   for i,v in ipairs(address) do print(i,v) end
  103.   print()
  104.   function dialNext(dialed)
  105.     glyph = address[dialed + 1]
  106.     print("Engaging "..glyph.."... ")
  107.  
  108.     sg.engageSymbol(glyph)
  109.   end
  110.   eventID = event.listen("stargate_spin_chevron_engaged"), function(evname, address, caller, num, lock, glyph)
  111.     os.sleep(2)
  112.  
  113.     if lock then
  114.       if (event.cancel(eventID)) then
  115.         print("Event cancelled successfully")
  116.       end
  117.       os.sleep(0.1)
  118.  
  119.       print("Engaging...")
  120.       sg.engageGate()
  121.  
  122.       doing = false
  123.       os.sleep(5) print("30")
  124.       os.sleep(1) print("29")
  125.       os.sleep(1) print("28")
  126.       os.sleep(1) print("27")
  127.       os.sleep(1) print("26")
  128.       os.sleep(1) print("25")
  129.       os.sleep(1) print("24")
  130.       os.sleep(1) print("23")
  131.       os.sleep(1) print("22")
  132.       os.sleep(1) print("21")
  133.       os.sleep(1) print("20")
  134.       os.sleep(1) print("19")
  135.       os.sleep(1) print("18")
  136.       os.sleep(1) print("17")
  137.       os.sleep(1) print("16")
  138.       os.sleep(1) print("15")
  139.       os.sleep(1) print("14")
  140.       os.sleep(1) print("13")
  141.       os.sleep(1) print("12")
  142.       os.sleep(1) print("11")
  143.       os.sleep(1) print("10")
  144.       os.sleep(1) print("9")
  145.       os.sleep(1) print("8")
  146.       os.sleep(1) print("7")
  147.       os.sleep(1) print("6")
  148.       os.sleep(1) print("5")
  149.       os.sleep(1) print("4")
  150.       os.sleep(1) print("3")
  151.       os.sleep(1) print("2")
  152.       os.sleep(1) print("1")
  153.       os.sleep(1) print("Stargate Shutdown")
  154.  
  155.       sg.disengageGate()
  156.       os.sleep(1)
  157.       computer.shutdown(true)
  158.     else
  159.       dialNext(num)
  160.     end
  161.   end
  162.   dialNext(0)
  163. until asd == 2
RAW Paste Data