Leon_Lejon

CC OS 2 os/Starter

Jun 12th, 2024 (edited)
168
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. old_pullEvent = os.pullEvent
  2. os.pullEvent = os.pullEventRaw
  3. term.setBackgroundColor(colors.black)
  4. settings.load()
  5. local firststart = settings.get("firststart")
  6. if firststart == 1 then
  7.     term.clear()
  8.     term.setCursorPos(1,1)
  9.     print("Welcome to CC OS 2 setup!")
  10.     print("Please choose a username")
  11.     username = read()
  12.     settings.define("username", {
  13.         description = "The users username",
  14.     })
  15.     settings.set("username", username)
  16.     print("Please choose a password")
  17.     password = read()
  18.     settings.define("password", {
  19.         description = "the users password",
  20.     })
  21.     settings.set("password", password)
  22.     print("Thank you for setting up CC!")
  23.     settings.set("firststart", 0)
  24.     settings.save()
  25.     sleep(3)
  26.     os.reboot()
  27. else
  28.     settings.load()
  29.     term.clear()
  30.     term.setCursorPos(1,1)
  31.     term.setTextColor(colors.white)
  32.     local logo = paintutils.loadImage("os/.logo")
  33.     paintutils.drawImage(logo , 1, 1)
  34.     term.setBackgroundColor(colors.black)
  35.     sleep(3)
  36.     term.setCursorPos(1,7)
  37.     print("Welcome to CC OS 2. Please login")
  38.     sleep(2)
  39.     io.write("Username: ")
  40.     username = read()
  41.     if username == settings.get("username") then
  42.         term.setCursorPos(1,9)
  43.         io.write("Password: ")
  44.         local password = read("*")
  45.             if password == settings.get("password") then
  46.                 term.clear()
  47.                 term.setCursorPos(1,1)
  48.                 print("Login successful!")
  49.                 sleep(2)
  50.                 term.clear()
  51.                 term.setCursorPos(1,1)
  52.                 if peripheral.find("speaker") == nil then
  53.                    
  54.                 else
  55.                     local adlogo = paintutils.loadImage("os/.adlogo")
  56.                     paintutils.drawImage(adlogo , 1, 1)
  57.                     sleep(3)
  58.                     term.setBackgroundColor(colors.black)
  59.                     term.clear()
  60.                     term.setCursorPos(1,1)
  61.                     speaker = peripheral.find("speaker")
  62.                     sleep(0.25)
  63.                     io.write("-----------")
  64.                     speaker.playNote("pling", 1, 3)
  65.                     sleep(0.25)
  66.                     io.write("-----------")
  67.                     speaker.playNote("pling", 1, 6)
  68.                     sleep(0.25)
  69.                     io.write("-----------")
  70.                     speaker.playNote("pling", 1, 8)
  71.                     sleep(0.25)
  72.                     io.write("-----------")
  73.                     speaker.playNote("pling", 1, 10)
  74.                     sleep(0.25)
  75.                     io.write("-------")
  76.                     speaker.playNote("pling", 1, 6)
  77.                     speaker.playNote("pling", 1, 10)
  78.                     speaker.playNote("pling", 1, 13)
  79.                     sleep(0.25)
  80.                     speaker.playNote("pling", 1 ,6)
  81.                     speaker.playNote("pling", 1 ,10)
  82.                     speaker.playNote("pling", 1 ,13)
  83.                 end
  84.                 term.clear()
  85.                 term.setCursorPos(1,1)
  86.                 term.setTextColor(colors.green)
  87.                 textutils.slowPrint("Welcome!", 5)
  88.                 sleep(0.25)
  89.                 term.setTextColor(colors.blue)
  90.                 term.clear()
  91.                 term.setCursorPos(1,1)
  92.                 print("Welcome!")
  93.                 sleep(0.25)
  94.                 term.clear()
  95.                 term.setCursorPos(1,1)
  96.                 term.setTextColor(colors.green)
  97.                 print("Welcome!")
  98.                 sleep(0.25)
  99.                 term.clear()
  100.                 term.setCursorPos(1,1)
  101.                 term.setTextColor(colors.blue)
  102.                 print("Welcome!")
  103.                 sleep(0.25)
  104.                 term.clear()
  105.                 term.setCursorPos(1,1)
  106.                 term.setTextColor(colors.green)
  107.                 print("Welcome!")
  108.                 print("Loading CC Interface")
  109.                 sleep(1)
  110.                 term.setTextColor(colors.white)
  111.                 paintutils.drawLine(1, 2, 100, 2, colors.green)
  112.                 os.pullEvent = old_pullEvent
  113.                 term.setBackgroundColor(colors.blue)
  114.                 shell.run("os/.startupscreen")
  115.             else
  116.                 print("Login failed, please try again!")
  117.                 sleep(2)
  118.                 os.reboot()
  119.             end
  120.     else
  121.         print("Username not found, please try again!")
  122.         sleep(2)
  123.         os.reboot()
  124.     end
  125. end
Advertisement
Add Comment
Please, Sign In to add comment