Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Define the direction and password
- local direction = "bottom"
- local correctPassword = "rarecorp"
- -- Find monitor
- local monitor = peripheral.find("monitor")
- monitor.setTextColor(colors.green) -- Set the text color to green
- -- Function to write text to the monitor with wrapping every 7 characters
- local function writeWrappedToMonitor(text, duration)
- monitor.clear()
- local lines = {}
- for i = 1, #text, 7 do
- table.insert(lines, text:sub(i, i + 6))
- end
- for y, line in ipairs(lines) do
- monitor.setCursorPos(1, y)
- monitor.write(line)
- end
- if duration then sleep(duration) end -- Pause for specified duration if provided
- end
- -- Function to write a message to both the terminal and the monitor
- local function writeToBoth(message, duration)
- term.write(message)
- writeWrappedToMonitor(message, duration)
- end
- -- Function to display idle screen on the monitor
- local function idleScreen()
- local R = {
- " ___ ",
- " / _ \\ ",
- " / , _/",
- "/_/|_/"
- }
- while true do
- monitor.clear()
- for y, line in ipairs(R) do
- monitor.setCursorPos(1, y)
- monitor.write(line)
- end
- sleep(1) -- Pause for 1 second
- end
- end
- -- Start the idle screen in a separate coroutine
- parallel.waitForAny(idleScreen, function()
- -- Splash message
- local splash = " ___ ___ ___ ____ _________ ___ ___ \n" ..
- " / _ \\/ _ | / _ \\/ __/ / ___/ __ \\/ _ \\/ _ \\\n" ..
- " / , _/ __ |/ , _/ _/ / /__/ /_/ / , _/ ___/\n" ..
- "/_/|_/_/ |_/_/|_/___/ \\___/\\____/_/|_/_/ \n" ..
- " \n" ..
- "Welcome to the system! Press any key to continue..."
- -- Infinite loop
- while true do
- -- Display splash message on the terminal
- term.clear()
- term.setCursorPos(1, 1)
- print(splash)
- os.pullEvent("key")
- term.clear()
- -- Prompt the user to enter the password
- term.setCursorPos(1,1)
- write("Enter password: ")
- local enteredPassword = read("*")
- -- Check if the entered password matches the correct password
- if enteredPassword == correctPassword then
- writeToBoth("Access granted. Welcome to RARE Corp.", 1)
- redstone.setOutput(direction, true)
- sleep(10)
- redstone.setOutput(direction, false)
- else
- writeToBoth("Access denied. Press ENTER...", 1)
- sleep(0.1)
- end
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement