Advertisement
CharlieWho

Charlie OS 2.0 Startup

May 22nd, 2019
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.73 KB | None | 0 0
  1. --NOTE: Put Theese ComputerCraft Files Inside A Disk Then You Can Install It From There Or Use It Live
  2.  
  3. --Boot
  4.  
  5. term.clear()
  6. print("Booting Charlie OS 2.0...")
  7. textutils.slowPrint("##########################################")
  8. term.clear()
  9.  
  10. --Custom Login System
  11. colored = true
  12.  
  13. if term.isColour() then
  14.   print("Terminal is colored.")
  15.   sleep(.1)
  16.   colored = true
  17. else
  18.   error("Terminal not colored.")
  19. end
  20.  
  21. password = {
  22.   username = "User";
  23.   password = "User";
  24. }
  25.  
  26. function SPixel(x,y,color)
  27.   term.setCursorPos(x,y); term.setTextColour(color)
  28.   term.setBackgroundColour(color); term.write("d")
  29.   term.setTextColour(colours.white); term.setBackgroundColour(colours.black)
  30. end
  31.  
  32. function SPixelText(x,y,color,textcol,b)
  33.   term.setCursorPos(x,y); term.setTextColour(textcol)
  34.   term.setBackgroundColour(color); term.write(b)
  35.   term.setTextColour(colours.white); term.setBackgroundColour(colours.black)
  36. end
  37.  
  38. term.clear()
  39. term.setCursorPos(1,1)
  40.  
  41. function login_colored()
  42.   term.clear()
  43.   term.setCursorPos(1,1)
  44.   for i=1, 51 do
  45.     SPixel(i,1,colours.grey)
  46.   end
  47.   SPixelText(1,1,colours.grey,colours.white,"Login System Made By ntnick")
  48.   term.setCursorPos(1,2)
  49.   io.write("Username: ")
  50.   local uName = read()
  51.   io.write("Password: ")
  52.   local pWord = read("*")
  53.   if(uName == password.username and pWord == password.password) then
  54.     term.clear()
  55.     term.setCursorPos(1,1)
  56.     return
  57.   elseif(uName ~= password.username and pWord ~= password.password) then
  58.     term.setCursorPos(1,19)
  59.     SPixelText(1,19,colours.black,colours.red,"Wrong password. Redirecting...")
  60.     sleep(2)
  61.     login_colored()
  62.   end
  63. end
  64.  
  65. login_colored()
  66.  
  67. --Desktop
  68. term.clear()
  69. print("Charlie OS 2.0 Desktop")
  70. shell.setDir("disk")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement