Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Clear the screen at the beginning
- term.clear()
- term.setCursorPos(1,1)
- -- Centered Menu Title
- local w, h = term.getSize()
- local title = "Elevator Display Control Download"
- local menuLine1 = "Please input 1 for controller and 2 for receiver"
- term.setCursorPos((w - #title) / 2, 2)
- print(title)
- term.setCursorPos((w - #menuLine1) / 2, 4)
- print(menuLine1)
- -- Function to get centered input
- function centeredInput(line)
- term.setCursorPos((w - #menuLine1) / 2, line)
- return read()
- end
- -- Get user choice and validate input
- local choice = centeredInput(6)
- if choice ~= "1" and choice ~= "2" then
- print("Invalid choice. Please restart and input 1 or 2.")
- return
- end
- -- Functions to download and setup for controller and receiver
- function setupController()
- shell.run("pastebin get bW4979ft controller")
- shell.run("pastebin get Wa7cyS89 setup")
- -- Create startup file
- local file = fs.open("startup", "w")
- file.writeLine("shell.run('controller')")
- file.close()
- -- Open controller setup program
- shell.run("setup")
- end
- function setupReceiver()
- shell.run("pastebin get CydZ2XTT receiver")
- shell.run("pastebin get 1xSfg2et setup")
- -- Create startup file
- local file = fs.open("startup", "w")
- file.writeLine("shell.run('receiver')")
- file.close()
- -- Open receiver setup program
- shell.run("setup")
- end
- -- Execute based on choice
- if choice == "1" then
- setupController()
- elseif choice == "2" then
- setupReceiver()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement