Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local guiColor = colors.green
- local port = 1 --The port to the server
- local id = 2 --The port to this terminal
- local name = "Test Terminal" --The display name of this terminal
- local side = "back"
- os.loadAPI("client")
- os.loadAPI("menu")
- local logs = {
- {
- "log1",
- "04.08.2020",
- "Updated the firmware of the terminal.",
- "This should allow me to log the happenings of the vault from here on out."
- },
- {
- "log2",
- "04.10.2020",
- "Rewrote a lot of the software to allow the terminals to connect to a server."
- }
- }
- function saveTable(table,name)
- local file = fs.open(name,"w")
- file.write(textutils.serialize(table))
- file.close()
- end
- function loadTable(name)
- local t = nil
- local file = fs.open(name,"r")
- if file then
- local data = file.readAll()
- t = textutils.unserialize(data)
- file.close()
- end
- return t
- end
- local logMenu = {}
- local temp = loadTable("logs.txt")
- if temp then logs = temp end
- for index = 1, #logs do
- local value = logs[index]
- local key = ""
- local v1 = ""
- local v2 = ""
- for nameCount = 1, #value do
- if nameCount == 1 then key = value[nameCount]
- elseif nameCount == 2 then v1 = value[nameCount]
- else v2 = v2..value[nameCount].." " end
- end
- menu.newText(key, v1, v2)
- logMenu[#logMenu +1] = {"read "..key, v1}
- end
- logMenu[#logMenu +1] = {"open start", "Back"}
- saveTable(logs, "logs.txt")
- menu.newMenu("start", "Overseer's Terminal", {
- --To add a bundled option: {colors.color, "Label", inverted}
- {"open ".."tools", "Management"},
- {"open ".."people", "Residents"},
- {"open ".."log", "Logs"}
- })
- menu.newMenu("tools", "Vault Management", {
- {"toggle "..colors.white, "Lights", true},
- {"trigger "..colors.red, "Overseer's Tunnel", false},
- {"open ".."start", "Back"}
- })
- menu.newMenu("people", "Residents", {
- {"read ".."resElrol", "Elrol_Arrowsend"},
- {"read ".."resMage", "_BlackMage_"},
- {"read ".."resToby", "BaconEater_Toby"},
- {"open ".."start", "Back"}
- })
- menu.newMenu("log", "Logs", logMenu)
- menu.newText("resElrol", "Elrol_Arrowsend", "Overseer of Vault 404")
- menu.newText("resMage", "_BlackMage_", "Manipulator of worlds")
- menu.newText("resToby", "BaconEater_Toby", "Apprentice to _BlackMage_")
- client.init(guiColor, port, id, name, side)
Add Comment
Please, Sign In to add comment