Advertisement
TaZeOS

os/programs/settings/start.lua

Nov 7th, 2018
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 6.73 KB | None | 0 0
  1. log(" ")
  2. log(" ")
  3. log("Settings App Started")
  4. log(" ")
  5. log(" ")
  6.  
  7.  
  8. function s(...) return sleep(...) end
  9.  function w(...) return write(...) end
  10.  function p(...) return print(...) end
  11.  function tw(...) return term.write(...) end
  12.  function scp(...) return term.setCursorPos(...) end
  13.  function sbc(...) return term.setBackgroundColor(...) end
  14.  function stc(...) return term.setTextColor(...) end
  15.  function tc(...) return term.clear(...) end
  16.  function tcl(...) return term.clearLine() end
  17.  function scb(...) return term.setCursorBlink(...) end
  18.  function ts(...) return term.scroll(...) end
  19.  function r(...) return shell.run(...) end
  20.  function para(...) return parallel.waitForAny(...) end
  21.  function sw(...) return textutils.slowWrite(...) end
  22.  function sp(...) return textutils.slowPrint(...) end
  23.  if skip == nil then
  24.  log("==> Adding taskbar")
  25.  taskbar.setVisible(true)
  26.   log("==> Creating app window")
  27.  Settingswindow = window.create(term.current(),1,2,51,18)
  28.  Settingswindow.setBackgroundColor(colors.purple)
  29.  Settingswindow.clear()
  30.  logo = paintutils.loadImage("OS/Programs/Settings/Settings.png")
  31.  paintutils.drawImage(logo, 1, 1 )
  32.  Settingswindow.setCursorPos(20,15)
  33.  Settingswindow.setTextColor(colors.white)
  34.  Settingswindow.setBackgroundColor(colors.purple)
  35.  Settingswindow.write("Settings")
  36.  if admin == "true" then
  37.  
  38.  else
  39.         adminpopup = window.create(term.current(),12,7,25,10)
  40.         adminpopup.setBackgroundColor(colors.white)
  41.         adminpopup.clear()
  42.         adminpopup.setCursorPos(1,1)
  43.         adminpopup.setBackgroundColor(colors.red)
  44.         adminpopup.setTextColor(colors.black)
  45.         adminpopup.write(" Admin Login                                                                    ")
  46.         adminpopup.setTextColor(colors.purple)
  47.         adminpopup.setCursorPos(2,2)
  48.         adminpopup.setBackgroundColor(colors.white)
  49.         adminpopup.setTextColor(colors.black)
  50.         adminpopup.write("Please login as a admin.")
  51.         adminpopup.setCursorPos(2,3)
  52.         adminpopup.write("To access \"Settings\"")
  53.         adminpopup.setCursorPos(2,5)
  54.         adminpopup.write("Username:")
  55.         adminpopup.setCursorPos(2,6)
  56.         adminpopup.setBackgroundColor(colors.lightGray)
  57.         adminpopup.write("             ")
  58.         adminpopup.setCursorPos(2,8)
  59.         adminpopup.setBackgroundColor(colors.white)
  60.         adminpopup.write("Password:")
  61.                 adminpopup.setCursorPos(2,9)
  62.         adminpopup.setBackgroundColor(colors.lightGray)
  63.         adminpopup.write("             ")
  64.  
  65.         while true do
  66.        
  67.        
  68.             scp(13,12)
  69.             sbc(colors.lightGray)
  70.             username = read()
  71.             scp(13,15)
  72.             sbc(colors.lightGray)
  73.             password = read("*")
  74.  
  75.            
  76.             checkUser()
  77.            
  78.             if username == UserInfo[1][1] and password == UserInfo[1][2] and admin1 == "true" or username == UserInfo[2][1] and password == UserInfo[2][2] and admin2 == "true" or username == UserInfo[3][1] and password == UserInfo[3][2] and admin3 == "true" or username == UserInfo[4][1] and password == UserInfo[4][2] and admin4 == "true" then
  79.    
  80.             Settingswindow.clear()
  81. paintutils.drawImage(logo, 1, 1 )
  82.  Settingswindow.setCursorPos(20,15)
  83.  Settingswindow.setTextColor(colors.white)
  84.  Settingswindow.setBackgroundColor(colors.purple)
  85.  Settingswindow.write("Settings")
  86.  
  87. break
  88.         else
  89.         shell.run('OS/desktop.lua')
  90.        
  91.         end
  92.         end
  93.  
  94.  end
  95.  sleep(4)
  96.  log("==> Prossecing animation")
  97.  Settingswindow.setBackgroundColor(colors.purple)
  98.  Settingswindow.clear()
  99.  paintutils.drawImage(logo, 5, 1 )
  100.  Settingswindow.setCursorPos(25,15)
  101.  Settingswindow.setTextColor(colors.white)
  102.  Settingswindow.setBackgroundColor(colors.purple)
  103.  Settingswindow.write("Settings")
  104.  sleep(0.1)
  105.  
  106.  
  107.  
  108.  
  109.   Settingswindow.setBackgroundColor(colors.purple)
  110.  Settingswindow.clear()
  111.  paintutils.drawImage(logo, 10, 1 )
  112.  Settingswindow.setCursorPos(30,15)
  113.  Settingswindow.setTextColor(colors.white)
  114.  Settingswindow.setBackgroundColor(colors.purple)
  115.  Settingswindow.write("Settings")
  116.  sleep(0.1)
  117.  
  118.  
  119.  
  120.   Settingswindow.setBackgroundColor(colors.purple)
  121.  Settingswindow.clear()
  122.  paintutils.drawImage(logo, 15, 1 )
  123.  Settingswindow.setCursorPos(35,15)
  124.  Settingswindow.setTextColor(colors.white)
  125.  Settingswindow.setBackgroundColor(colors.purple)
  126.  Settingswindow.write("Settings")
  127.  sleep(0.1)
  128.  
  129.  
  130.  
  131.  
  132.   Settingswindow.setBackgroundColor(colors.purple)
  133.  Settingswindow.clear()
  134.  paintutils.drawImage(logo, 20, 1 )
  135.  Settingswindow.setCursorPos(40,15)
  136.  Settingswindow.setTextColor(colors.white)
  137.  Settingswindow.setBackgroundColor(colors.purple)
  138.  Settingswindow.write("Settings")
  139.  sleep(0.1)
  140.  
  141.  
  142.  
  143.   Settingswindow.setBackgroundColor(colors.purple)
  144.  Settingswindow.clear()
  145.  paintutils.drawImage(logo, 25, 1 )
  146.  Settingswindow.setCursorPos(45,15)
  147.  Settingswindow.setTextColor(colors.white)
  148.  Settingswindow.setBackgroundColor(colors.purple)
  149.  Settingswindow.write("Settings")
  150.  sleep(0.1)
  151.  
  152.  
  153.  
  154.   Settingswindow.setBackgroundColor(colors.purple)
  155.  Settingswindow.clear()
  156.  paintutils.drawImage(logo, 30, 1 )
  157.  Settingswindow.setCursorPos(50,15)
  158.  Settingswindow.setTextColor(colors.white)
  159.  Settingswindow.setBackgroundColor(colors.purple)
  160.  Settingswindow.write("Settings")
  161.  sleep(0.1)
  162.  
  163.  
  164.  
  165.   Settingswindow.setBackgroundColor(colors.purple)
  166.  Settingswindow.clear()
  167.  paintutils.drawImage(logo, 32, 1 )
  168.  Settingswindow.setCursorPos(51,15)
  169.  Settingswindow.setTextColor(colors.white)
  170.  Settingswindow.setBackgroundColor(colors.purple)
  171.  Settingswindow.write("Settings")
  172.  sleep(0.1)
  173.  
  174.  
  175.   Settingswindow.setBackgroundColor(colors.purple)
  176.  Settingswindow.clear()
  177.  paintutils.drawImage(logo, 35, 1 )
  178.  
  179.  sleep(1)
  180.  taskbar.setBackgroundColor(colors.lightGray )
  181.  taskbar.clear()
  182.  
  183.  taskbar.setCursorPos(1,1)
  184.  log("==> Settings Started!")
  185. else
  186.    
  187.     skip = nil
  188.    
  189. end
  190.  
  191. taskbar.setBackgroundColor( colors.lightGray )
  192. taskbar.clear()
  193. taskbar.setCursorPos(1,1)
  194.  taskbar.write(" Settings")
  195.  taskbar.setCursorPos(49,1)
  196.  taskbar.setTextColor(colors.red)
  197.  taskbar.write("#")
  198.  taskbar.setTextColor(colors.white)
  199.  Settingswindow.setBackgroundColor(colors.white)
  200.  Settingswindow.clear()
  201.  profileicon = paintutils.loadImage("OS/Programs/Settings/profile.png")
  202.  paintutils.drawImage(profileicon, 2, 4 )
  203.  Settingswindow.setCursorPos(2,4)
  204.  Settingswindow.setBackgroundColor(colors.red)
  205.  Settingswindow.write(" Profile ")
  206.   profileicon = paintutils.loadImage("OS/Programs/Settings/profile.png")
  207.  paintutils.drawImage(profileicon, 13, 4 )
  208.  Settingswindow.setCursorPos(13,4)
  209.  Settingswindow.setBackgroundColor(colors.red)
  210.  Settingswindow.write(" Domain  ")
  211.  
  212.  while true do
  213.  
  214.         local event, button, x, y = os.pullEvent("mouse_click")
  215.  
  216.    
  217.  
  218.         if x >= 2 and x <= 10 and y >= 4 and y <= 6 then
  219.        
  220.         shell.run('OS/programs/settings/profile.lua')
  221.         elseif x >= 13 and x <= 21 and y >= 4 and y <= 6 then
  222.        
  223.         shell.run('OS/programs/settings/domain.lua')
  224.        
  225.     elseif x == 49 and y == 1 then
  226.     shell.run('OS/desktop.lua')
  227.        
  228. end
  229.  end
  230.  
  231.  sleep(5)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement