Elrol

clientStartup

Apr 10th, 2020 (edited)
329
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.55 KB | None | 0 0
  1. --white 1
  2. --lightGray 256
  3. --gray 128
  4. --black 32768
  5. --brown 4096
  6. --red 16384
  7. --orange 2
  8. --yellow 16
  9. --lime 32
  10. --green 8192
  11. --cyan 512
  12. --lightBlue 8
  13. --blue 2048
  14. --purple 1024
  15. --magenta 4
  16. --pink 64
  17.  
  18. local name = "Terminal" --The display name of this terminal
  19. local port = 1 --The port to this terminal
  20. local serverPort = 0 --The port to the server for this terminal
  21. local side = "top" --The location of the modem
  22. local guiColor = colors.green
  23.  
  24. local logs = {
  25.     {
  26.         "log1",
  27.         "04.08.2020",
  28.         "Updated the firmware of the terminal.",
  29.         "This should allow me to log the happenings of the vault from here on out."
  30.     },
  31.     {
  32.         "log2",
  33.         "04.10.2020",
  34.         "Rewrote a lot of the software to allow the terminals to connect to a server."
  35.     },
  36.     {
  37.         "log3",
  38.         "11.12.2025",
  39.         "Working on updating some features to allow the server to send a signal to a connected terminal",
  40.     }
  41. }
  42.  
  43. local menu = require("menu")
  44. local client = require("client")
  45.  
  46. if not menu.loadMenus() then
  47.     print("Failed to load menus, creating defaults")
  48.     local logMenu = {}
  49.  
  50.     for index = 1, #logs do
  51.         local value = logs[index]
  52.         local key = ""
  53.         local v1 = ""
  54.         local v2 = ""
  55.         for nameCount = 1, #value do
  56.             if nameCount == 1 then key = value[nameCount]
  57.             elseif nameCount == 2 then v1 = value[nameCount]
  58.             else v2 = v2..value[nameCount].." " end
  59.         end
  60.         menu.newText(key, v1, v2)
  61.         logMenu[#logMenu +1] = {"read "..key, v1}
  62.     end
  63.     logMenu[#logMenu +1] = {"open start", "Back"}
  64.  
  65.     -- All toggle and trigger options need a target port for the second argument
  66.     menu.newMenu("start", "Overseer's Terminal", {
  67.         --To add a bundled option: {colors.color, "Label", inverted}
  68.         {"open ".."tools", "Management"},
  69.         {"open ".."people", "Residents"},
  70.         {"open ".."log", "Logs"}
  71.     })
  72.  
  73.     menu.newMenu("tools", "Vault Management", {
  74.         {"toggle 1 "..colors.white, "Lights", true},
  75.         {"trigger 1 "..colors.red, "Overseer's Tunnel", false},
  76.         {"open ".."start", "Back"}
  77.     })
  78.  
  79.     menu.newMenu("people", "Residents", {
  80.         {"read ".."resElrol", "Elrol_Arrowsend"},
  81.         {"read ".."resMage", "_BlackMage_"},
  82.         {"read ".."resToby", "BaconEater_Toby"},
  83.         {"open ".."start", "Back"}
  84.     })
  85.  
  86.     menu.newMenu("log", "Logs", logMenu)
  87.  
  88.     menu.newText("resElrol", "Elrol_Arrowsend", "Overseer of Vault 404")
  89.     menu.newText("resMage", "_BlackMage_", "Manipulator of worlds")
  90.     menu.newText("resToby", "BaconEater_Toby", "Apprentice to _BlackMage_")
  91.    
  92.     menu.saveMenus()
  93. else
  94.     print("Menus Loadded")
  95. end
  96.  
  97. client.init(name, port, serverPort, side, guiColor)
  98.  
Advertisement
Add Comment
Please, Sign In to add comment