Advertisement
Guest User

startup

a guest
Jan 10th, 2018
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.48 KB | None | 0 0
  1. -- What PqtatoOS calls you - Default: Pqtato
  2. local name = "Pqtato"
  3. -- What you want PqtatoOS to be called - Default: PqtatoOS
  4. local osName = "PqtatoOS" -- No longer used
  5. -- DO NOT CHANGE THIS!
  6. local version = "1.0.0"
  7. -- Your password. Example: bacon Default: cheese
  8. local password = "cheese"
  9. -- Centered Text
  10. local function centerText(text)
  11.   local w, h = term.getSize()
  12.   term.setCursorPos(math.floor(w / 2 - text:len() / 2 + .5), math.floor(h / 2 + .5))
  13.   io.write(text)
  14. end
  15. local function centerText2(text)
  16.   local w, h = term.getSize()
  17.   term.setCursorPos(math.floor(w / 2 - text:len() / 2 + .5), math.floor(h / 2 + 1.5))
  18.   io.write(text)
  19. end
  20.  
  21. -- Startup
  22. term.setBackgroundColor(colors.cyan)
  23. term.setTextColor(colors.white)
  24. shell.run("pqtatoos/.openModem")
  25. term.clear()
  26. term.setCursorPos(1,1)
  27. centerText(osName)
  28. sleep(1.5)
  29. term.clear()
  30. term.setCursorPos(1,1)
  31. print("Username: ", name)
  32. term.setCursorPos(1,2)
  33. print("Password: ")
  34. term.setCursorPos(11,2)
  35. inputP = read('*')
  36.  
  37. if(inputP == password) then
  38.   local w, h = term.getSize()
  39.   term.setBackgroundColor(colors.black)
  40.   term.setTextColor(colors.white)
  41.   term.clear()
  42.   term.setBackgroundColor(colors.red)
  43.   term.setCursorPos(1,1)
  44.   term.clearLine()
  45.   write("                                        ")
  46.   term.setCursorPos(math.floor(w / 2 - 8 / 2 + .5),1)
  47.   write("PqtatoOS")
  48.   term.setBackgroundColor(colors.black)
  49.   term.setCursorPos(1,2)
  50. else
  51.   print("Incorrect password!")
  52.   sleep(3)
  53.   os.reboot()
  54. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement