Advertisement
Mojokojo69

rarecorplogin

Aug 21st, 2023 (edited)
24
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.43 KB | None | 0 0
  1. -- Define the direction and password
  2. local direction = "bottom"
  3. local correctPassword = "rarecorp"
  4.  
  5. -- Find monitor
  6. local monitor = peripheral.find("monitor")
  7. monitor.setTextColor(colors.green) -- Set the text color to green
  8.  
  9. -- Function to write text to the monitor with wrapping every 7 characters
  10. local function writeWrappedToMonitor(text, duration)
  11. monitor.clear()
  12. local lines = {}
  13. for i = 1, #text, 7 do
  14. table.insert(lines, text:sub(i, i + 6))
  15. end
  16. for y, line in ipairs(lines) do
  17. monitor.setCursorPos(1, y)
  18. monitor.write(line)
  19. end
  20. if duration then sleep(duration) end -- Pause for specified duration if provided
  21. end
  22.  
  23. -- Function to write a message to both the terminal and the monitor
  24. local function writeToBoth(message, duration)
  25. term.write(message)
  26. writeWrappedToMonitor(message, duration)
  27. end
  28.  
  29. -- Function to display idle screen on the monitor
  30. local function idleScreen()
  31. local R = {
  32. " ___ ",
  33. " / _ \\ ",
  34. " / , _/",
  35. "/_/|_/"
  36. }
  37. while true do
  38. monitor.clear()
  39. for y, line in ipairs(R) do
  40. monitor.setCursorPos(1, y)
  41. monitor.write(line)
  42. end
  43. sleep(1) -- Pause for 1 second
  44. end
  45. end
  46.  
  47. -- Start the idle screen in a separate coroutine
  48. parallel.waitForAny(idleScreen, function()
  49. -- Splash message
  50. local splash = " ___ ___ ___ ____ _________ ___ ___ \n" ..
  51. " / _ \\/ _ | / _ \\/ __/ / ___/ __ \\/ _ \\/ _ \\\n" ..
  52. " / , _/ __ |/ , _/ _/ / /__/ /_/ / , _/ ___/\n" ..
  53. "/_/|_/_/ |_/_/|_/___/ \\___/\\____/_/|_/_/ \n" ..
  54. " \n" ..
  55. "Welcome to the system! Press any key to continue..."
  56.  
  57. -- Infinite loop
  58. while true do
  59. -- Display splash message on the terminal
  60. term.clear()
  61. term.setCursorPos(1, 1)
  62. print(splash)
  63. os.pullEvent("key")
  64. term.clear()
  65.  
  66. -- Prompt the user to enter the password
  67. term.setCursorPos(1,1)
  68. write("Enter password: ")
  69. local enteredPassword = read("*")
  70.  
  71. -- Check if the entered password matches the correct password
  72. if enteredPassword == correctPassword then
  73. writeToBoth("Access granted. Welcome to RARE Corp.", 1)
  74. redstone.setOutput(direction, true)
  75. sleep(10)
  76. redstone.setOutput(direction, false)
  77. else
  78. writeToBoth("Access denied. Press ENTER...", 1)
  79. sleep(0.1)
  80. end
  81. end
  82. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement