Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local c = require("component")
- local term = require("term")
- local component = require("component")
- local event = require("event")
- local serialization = require("serialization")
- local gpu = component.gpu
- local w, h = gpu.getResolution()
- gpu.fill(1, 1, w, h, " ")
- local modem = c.modem
- local asd = 1
- local port = 123
- local os = require("os")
- local address
- repeat
- term.clear(true)
- print("SGC Dialing Computer")
- print("")
- print("Which Gate do you want to connect to? (Number only)")
- print("1. Spawn")
- print("2. Nether")
- print("3. Alpha site")
- print("4. SHUTDOWN GATE!")
- print("5. I wanna charge the alpha site.")
- print("6. I want to type my adress manually")
- num = io.read()
- print()
- if num == "1" then
- print("Dialing Spawn.")
- modem.broadcast(port, "dial1")
- print("Address sent to gate computer.")
- os.sleep(5)
- elseif num == "2" then
- print("Dialing Neather.")
- modem.broadcast(port, "dial2", address, 9)
- print("Address sent to gate computer.")
- os.sleep(5)
- elseif num == "3" then
- print("Dialing Alpha Site.")
- modem.broadcast(port, "dial3", address, 9)
- print("Address sent to gate computer.")
- os.sleep(5)
- elseif num == "4" then
- print("Gate Shutdown Issued!")
- modem.broadcast(port, "sd", address, 9)
- print("Shutdown command sent.")
- os.sleep(5)
- elseif num == "5" then
- print("Dialing Alpha Site and engaging power beam.")
- print("Select how long the power beam will be active")
- print("1,2,3,4 or 5 minutes")
- print("1 minute = 20 million RF")
- num = io.read()
- print()
- if num == "1" then
- modem.broadcast(port, "charge1", address, 9)
- print("Sending Power for 1 Minute.")
- elseif num == "2" then
- modem.broadcast(port, "charge2", address, 9)
- print("Sending Power for 2 Minutes.")
- elseif num == "3" then
- modem.broadcast(port, "charge3", address, 9)
- print("Sending Power for 3 Minutes.")
- elseif num == "4" then
- modem.broadcast(port, "charge4", address, 9)
- print("Sending Power for 4 Minutes.")
- elseif num == "5" then
- modem.broadcast(port, "charge5", address, 9)
- print("Sending Power for 5 Minutes.")
- elseif num ~= "1" or num ~= "2" or num ~= "3" or num ~= "4" or num ~= "5" then
- print("ERROR: Wrong number typed!")
- else
- print("UNKNOWN ERROR")
- end
- os.sleep(5)
- elseif num == "6" then
- print("How many symbols do you want to dial?(7/8/9)")
- num = io.read()
- print()
- if num == "7" then
- print("The program will require 6 symbols from you (7th symbol is automatic). Start typing now.")
- print("Symbol 1")
- chev1 = io.read()
- print("Symbol 2")
- chev2 = io.read()
- print("Symbol 3")
- chev3 = io.read()
- print("Symbol 4")
- chev4 = io.read()
- print("Symbol 5")
- chev5 = io.read()
- print("Symbol 6")
- chev6 = io.read()
- chev7 = "Point of Origin"
- if chev1 == chev2 or chev1 == chev3 or chev1 == chev4 or chev1 == chev6 or chev1 == chev7 or chev2 == chev3 or chev2 == chev4 or
- chev2 == chev6 or chev2 == chev7 or chev3 == chev4 or chev3 == chev5 or chev3 == chev6 or chev3 == chev7 or chev4 == chev5 or chev4 == chev6
- or chev4 == chev7 or chev5 == chev6 or chev5 == chev7 or chev6 == chev7 then
- print("ERROR: Two symbols are the same")
- else
- address_raw = {chev1, chev2, chev3, chev4, chev5, chev6, chev7}
- print()
- print("Confirm address: ".. chev1 ..", ".. chev2 ..", ".. chev3 ..", ".. chev4 ..", ".. chev5 ..", ".. chev6 ..", ".. chev7 .." (y/n)")
- local answer = io.read()
- if answer == "y" then
- address = serialization.serialize(address_raw)
- modem.broadcast(port, "manual", address)
- print("Address sent to gate computer.")
- else
- print("Dialing Aborted")
- os.sleep(5)
- end
- end
- elseif num == "8" then
- print("The program will require 7 symbols from you (8th symbol is automatic). Write the symbols' full names.")
- print("Symbol 1")
- chev1 = io.read()
- print("Symbol 2")
- chev2 = io.read()
- print("Symbol 3")
- chev3 = io.read()
- print("Symbol 4")
- chev4 = io.read()
- print("Symbol 5")
- chev5 = io.read()
- print("Symbol 6")
- chev6 = io.read()
- print("Symbol 7")
- chev7 = io.read()
- chev8 = "Point of Origin"
- if chev1 == chev2 or chev1 == chev3 or chev1 == chev4 or chev1 == chev6 or chev1 == chev7 or chev1 == chev8 or chev2 == chev3 or chev2 ==
- chev4 or chev2 == chev6 or chev2 == chev7 or chev2 == chev8 or chev3 == chev4 or chev3 == chev5 or chev3 == chev6 or chev3 == chev7 or chev3
- == chev8 or chev4 == chev5 or chev4 == chev6 or chev4 == chev7 or chev4 == chev8 or chev5 == chev6 or chev5 == chev7 or chev5 == chev8 or
- chev6 == chev7 or chev6 == chev8 or chev7 == chev8 then
- print("ERROR: Two symbols are the same")
- else
- address_raw = {chev1, chev2, chev3, chev4, chev5, chev6, chev7, chev8}
- print()
- print("Confirm address: ".. chev1 ..", ".. chev2 ..", ".. chev3 ..", ".. chev4 ..", ".. chev5 ..", ".. chev6 ..", ".. chev7 ..", ".. chev8 .." (y/n)")
- local answer = io.read()
- if answer == "y" then
- address = serialization.serialize(address_raw)
- modem.broadcast(port, "manual", address)
- print("Address sent to gate computer.")
- else
- print("Dialing Aborted")
- os.sleep(5)
- end
- end
- elseif num == "9" then
- print("The program will require 8 symbols from you (9th symbol is automatic). Start typing now.")
- print("Symbol 1")
- chev1 = io.read()
- print("Symbol 2")
- chev2 = io.read()
- print("Symbol 3")
- chev3 = io.read()
- print("Symbol 4")
- chev4 = io.read()
- print("Symbol 5")
- chev5 = io.read()
- print("Symbol 6")
- chev6 = io.read()
- print("Symbol 7")
- chev7 = io.read()
- print("Symbol 8")
- chev8 = io.read()
- chev9 = "Point of Origin"
- if chev1 == chev2 or chev1 == chev3 or chev1 == chev4 or chev1 == chev6 or chev1 == chev7 or chev1 == chev8 or chev1 == chev9 or
- chev2 == chev3 or chev2 == chev4 or chev2 == chev6 or chev2 == chev7 or chev2 == chev8 or chev2 == chev9 or chev3 == chev4 or chev3 == chev5
- or chev3 == chev6 or chev3 == chev7 or chev3 == chev8 or chev3 == chev9 or chev4 == chev5 or chev4 == chev6 or chev4 == chev7 or chev4 ==
- chev8 or chev4 == chev9 or chev5 == chev6 or chev5 == chev7 or chev5 == chev8 or chev5 == chev9 or chev6 == chev7 or chev6 == chev8 or chev6
- == chev9 or chev7 == chev8 or chev7 == chev9 or chev8 == chev9 then
- print("ERROR: Two symbols are the same")
- else
- address_raw = {chev1, chev2, chev3, chev4, chev5, chev6, chev7, chev8, chev9}
- print()
- print("Confirm address: ".. chev1 ..", ".. chev2 ..", ".. chev3 ..", ".. chev4 ..", ".. chev5 ..", ".. chev6 ..", ".. chev7 ..", "..
- chev8 ..", ".. chev9 .." (y/n)")
- local answer = io.read()
- if answer == "y" then
- address = serialization.serialize(address_raw)
- modem.broadcast(port, "manual", address, 9)
- print("Address sent to gate computer.")
- else
- print("Dialing Aborted")
- os.sleep(5)
- end
- end
- elseif num ~= "9" or num ~= "8" or num ~= "7" then
- print("ERROR: number is not 7 or 8")
- else
- print("UNKNOWN ERROR")
- end
- os.sleep(5)
- elseif num ~= "1" or num ~= "2" or num ~= "3" or num ~= "4" or num ~= "5" or num ~= "6" then
- print("ERROR: Wrong number typed!")
- os.sleep(5)
- else
- print("UNKNOWN ERROR")
- os.sleep(5)
- end
- until asd == 2
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement