Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[
- To download this to a computer, run this command in the command line:
- pastebin get mrgQrQXB startup.lua
- Once it has downloaded, reboot the computer
- It will prompt you with a choice between this being a terminal or a server
- After you make your choice, type it in, and hit enter.
- This will install the needed files to the computer.
- When it is finished, run the following command:
- edit startup.lua
- Here you can change the settings to whatever you want
- For a server:
- Name: The name of the server. This will be shown to all connected terminals
- Port: The port of the server. This is a unique number for terminals to send commands to
- Side: The side of the block where the modem is located
- Cable: The bundled cable where to output the redstone signals
- GuiColor: The color of the text for the server interface
- For a client:
- Name: The name of this terminal. It will be displayed on the terminal interface and used to identify which terminals are doing what on the server. This helps with debugging to make sure things are working
- Port: The port of the terminal. This is a unique number needed for the terminal to get the response from the server when running commands
- ServerPort: The port of the server. This is needed so the terminal knows where to send it's commands
- Side: The side of the block where the modem is located
- GuiColor: The color of the text for the terminal interface
- After you finish configuring the computer, press the [ctrl] button on your keyboard then [enter] to save the file
- Finally, restart the computer again.
- Now the only change that needs to happen is on the terminals. They will have a file called data.json
- This file contains the logs(texts) and menus that the terminal will show.
- For Texts, each one will need a unique key.
- In the Text object, you will need three parts. An id, title, and txt. Here is an example:
- "key": {
- "id": "key", << This needs to be the same as the one above!
- "title": "The text to display on the UI when selecting a log",
- "txt": "The contents of the log that will be displayed after opening the log"
- }
- For the menus, each one will also need a unique id. Though, you can have the same ID for a menu and a text, it would be best to have them not be
- Here is an example:
- "key": {
- "id": "key",
- "title": "The text to display as a sub-header"
- "cmds":[
- [
- "toggle 100 1",
- "Lights",
- false
- ]
- ]
- }
- For the commands, each will be a button to select on the menu. It is an array
- The first string in a command's array is the command to send to the server
- The second is the text to display on the menu.
- For toggle commands, you can invert the displayed text. This would show that it is on when no redsstone signal is being sent out. This is just for cosmetic purposes and functions the same either way
- These are the current commands that can be sent, more will likely be added:
- "name:{terminalName}" - This sends the terminal's name to the server and the server sends back the server name
- "toggle {targetPort} {color}" - This will toggle the signal of the bundled cable at the server targeted. The color needs to be the numerical value which will be listed below
- "trigger {targetPort} {color}" - This will toggle the signal for the color and then, after a second, toggle it again.
- "check {targetPort} {color}" - This checks if the specified color cable is being output or not
- "stop {targetPort}" - Stops the specified server
- "ping {targetPort}" - Pings the server
- Numeric values for the color for bundled cables
- --white 1
- --lightGray 256
- --gray 128
- --black 32768
- --brown 4096
- --red 16384
- --orange 2
- --yellow 16
- --lime 32
- --green 8192
- --cyan 512
- --lightBlue 8
- --blue 2048
- --purple 1024
- --magenta 4
- --pink 64
- ]]
- local color = colors.green
- local w, h = term.getSize()
- local serverFiles = {}
- serverFiles.server = "G8jS60D1"
- serverFiles.startup = "pAuEZD46"
- local clientFiles = {}
- clientFiles.client = "dSYLZtkX"
- clientFiles.menu = "iz95vBeb"
- clientFiles.startup = "kvwgz7L0"
- function init()
- term.setTextColor(color)
- term.setBackgroundColor(colors.black)
- term.clear()
- term.setCursorPos(1,1)
- info("ROBCO INDUSTRIES UNIFIED OPERATING SYSTEM", true)
- info("COPYRIGHT 2019-2020 ROBCO INDUSTRIES", true)
- info("-Server 1-", true)
- info(nil, false)
- info("Terminal Setup", false)
- info("======================", false)
- info("Install for Terminal or Server?", false)
- hr()
- local side = read()
- if side == "server" or side == "Server" then
- server()
- elseif side == "terminal" or side == "Terminal" then
- client()
- else
- term.clear()
- term.setCursorPos(1,1)
- end
- end
- function hr()
- x, y = term.getCursorPos()
- for i = 1, w, 1 do
- write("-")
- end
- term.setCursorPos(1, y+1)
- end
- function info(text, isCenter)
- if text == nil then
- term.setCursorPos(1, y+2)
- elseif isCenter then
- x, y = term.getCursorPos()
- x = (w - #text) / 2
- term.setCursorPos(x, y)
- write(text)
- term.setCursorPos(1, y+1)
- else
- print(text)
- end
- end
- function install(link,file)
- if fs.exists(file) then
- fs.delete(file)
- shell.run("pastebin", "get", link, file)
- print("Updated "..file)
- else
- shell.run("pastebin", "get", link, file)
- print("Installed "..file)
- end
- end
- function server()
- info("Installing Server", false)
- for f, l in pairs(serverFiles) do
- install(l, f..".lua")
- end
- end
- function client()
- info("Intalling Client", false)
- for f, l in pairs(clientFiles) do
- install(l, f..".lua")
- end
- end
- init()
Advertisement
Add Comment
Please, Sign In to add comment