Advertisement
Alexr360

Stargate Control

Mar 29th, 2024 (edited)
573
1
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.83 KB | None | 1 0
  1. local function clearScreen()
  2.   term.clear()
  3.   term.setCursorPos(1, 1)
  4. end
  5.  
  6. function dial(address)
  7.     interface = peripheral.find("crystal_interface")
  8.  
  9.     local addressLength = #address
  10.  
  11.     local start = interface.getChevronsEngaged() + 1
  12.  
  13.     for chevron = start,addressLength,1
  14.     do
  15.         interface.engageSymbol(address[chevron])
  16.         os.sleep(0.5)
  17.         print("Symbol Engaged: " .. address[chevron])
  18.     end
  19. end
  20.  
  21. -- Define destinations with labels and addresses
  22. local destinations = {
  23.     {label = "Citadel",         address = {14,6,10,2,20,33,23,17,0}},
  24.     {label = "A-Base",          address = {14,26,30,21,35,2,18,22,0}},
  25.     {label = "Spawn",           address = {18,2,12,20,31,5,28,25,0}},
  26.     {label = "Nether",          address = {28,25,14,19,18,26,32,31,0}},
  27.     {label = "Stripmine",       address = {32,9,1,12,31,10,24,23,0}},
  28.     {label = "Abydos",          address = {26,6,14,31,11,29,0}},
  29.     {label = "The End",         address = {14,30,6,13,17,23,0}},
  30.     {label = "Cavum Tenebrae",  address = {18,7,3,36,25,15,0}},
  31.     {label = "Chulak",          address = {8,1,22,14,36,19,0}},
  32.     {label = "Backup",          address = {15,5,4,30,6,35,19,20,0}},
  33.     {label = "Otherside",       address = {21,38,36,34,35,37,0}}
  34.  
  35. }
  36.  
  37. clearScreen()
  38.  
  39. -- Print available destinations
  40. print("Available destinations:")
  41. for i, dest in ipairs(destinations) do
  42.     print(i .. " = " .. dest.label)
  43. end
  44.  
  45. -- Get user input
  46. print("Select a destination:")
  47. local input = tonumber(io.read()) -- Read input as number
  48.  
  49. -- Dial the selected destination if input is valid
  50. if input and input >= 1 and input <= #destinations then
  51.     clearScreen()
  52.     print("Dialing...")
  53.     dial(destinations[input].address) -- Dial the address of the selected destination
  54. elseif input == 404 then
  55.     dial({15,5,4,30,6,35,19,20,0})
  56.     print("Error...")
  57. else
  58.     print("Invalid input")
  59. end
  60.  
  61. shell.run("startup")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement