Advertisement
Nhorr

NhUIv0.1a (CraftOS 1.5+ compatible)

Jul 8th, 2015
317
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 5.23 KB | None | 0 0
  1. --Password startup
  2. os.pullEvent = os.pullEventRaw
  3. local pass = "password" --Desired password
  4.  
  5. while true do
  6.   term.clear()
  7.   term.setCursorPos(1,1)
  8.   print("Loading secure startup")
  9.   sleep(.2)
  10.   term.clear()
  11.   term.setCursorPos(1,1)
  12.   print("Loading secure startup.")
  13.   sleep(.2)
  14.   term.clear()
  15.   term.setCursorPos(1,1)
  16.   print("Loading secure startup..")
  17.   sleep(.2)
  18.   term.clear()
  19.   term.setCursorPos(1,1)
  20.   print("Loading secure startup...")
  21.   sleep(.2)
  22.  
  23.   print("No errors detected.")
  24.   sleep(.3)
  25.  
  26.   print("Starting password protocols")
  27.   sleep(.2)
  28.   term.clear()
  29.   term.setCursorPos(1,1)
  30.   print("Loading secure startup...")
  31.   print("No errors detected.")
  32.   print("Starting password protocols.")
  33.   sleep(.2)
  34.   term.clear()
  35.   term.setCursorPos(1,1)
  36.   print("Loading secure startup...")
  37.   print("No errors detected.")
  38.   print("Starting password protocols..")
  39.   sleep(.2)
  40.   term.clear()
  41.   term.setCursorPos(1,1)
  42.   print("Loading secure startup...")
  43.   print("No errors detected.")
  44.   print("Starting password protocols...")
  45.   sleep(.3)
  46.  
  47.   term.clear()
  48.   term.setCursorPos(1,1)
  49.   sleep(.4)
  50.   print("Password required.")
  51.   print("Please type in the password.")
  52.  
  53.   local input = read("*")
  54.   if input == pass then
  55.     term.clear()
  56.     term.setCursorPos(1,1)
  57.     sleep(.1)
  58.     print("Password accepted.")
  59.     sleep(.6)
  60.  
  61.     print("Loading NhUI v0.1a - 0%")
  62.     sleep(.2)
  63.     term.clear()
  64.     term.setCursorPos(1,1)
  65.     print("Password accepted.")
  66.     print("Loading NhUI v0.1a - 36%")
  67.     sleep(.2)
  68.     term.clear()
  69.     term.setCursorPos(1,1)
  70.     print("Password accepted.")
  71.     print("Loading NhUI v0.1a - 74%")
  72.     sleep(.2)
  73.     term.clear()
  74.     term.setCursorPos(1,1)
  75.     print("Password accepted.")
  76.     print("Loading NhUI v0.1a - 100%")
  77.     sleep(.3)
  78.  
  79.     print("Loading complete.")
  80.     sleep(.2)
  81.  
  82.     print("Initializing")
  83.     sleep(.2)
  84.     term.clear()
  85.     term.setCursorPos(1,1)
  86.     print("Password accepted.")
  87.     print("Loading NhUI v0.1a - 100%")
  88.     print("Loading complete.")
  89.     print("Initializing.")
  90.     sleep(.2)
  91.     term.clear()
  92.     term.setCursorPos(1,1)
  93.     print("Password accepted.")
  94.     print("Loading NhUI v0.1a - 100%")
  95.     print("Loading complete.")
  96.     print("Initializing..")
  97.     sleep(.2)
  98.     term.clear()
  99.     term.setCursorPos(1,1)
  100.     print("Password accepted.")
  101.     print("Loading NhUI v0.1a - 100%")
  102.     print("Loading complete.")
  103.     print("Initializing...")
  104.     sleep(.4)
  105.  
  106.     term.clear()
  107.     term.setCursorPos(1,1)
  108.     sleep(.6)
  109.     break
  110.   else
  111.     print("Access denied.")
  112.     sleep(.6)
  113.     term.clear()
  114.     term.setCursorPos(1,1)
  115.     print("Clearing cache")
  116.     sleep(.2)
  117.     term.clear()
  118.     term.setCursorPos(1,1)
  119.     print("Clearing cache.")
  120.     sleep(.2)
  121.     term.clear()
  122.     term.setCursorPos(1,1)
  123.     print("Clearing cache..")
  124.     sleep(.2)
  125.     term.clear()
  126.     term.setCursorPos(1,1)
  127.     print("Clearing cache...")
  128.     sleep(.3)
  129.  
  130.     print("Cache cleared.")
  131.     sleep(.2)
  132.  
  133.     print("Resetting parameters")
  134.     sleep(.3)
  135.     term.clear()
  136.     term.setCursorPos(1,1)
  137.     print("Clearing cache...")
  138.     print("Cache cleared.")
  139.     print("Resetting parameters.")
  140.     sleep(.3)
  141.     term.clear()
  142.     term.setCursorPos(1,1)
  143.     print("Clearing cache...")
  144.     print("Cache cleared.")
  145.     print("Resetting parameters..")
  146.     sleep(.3)
  147.     term.clear()
  148.     term.setCursorPos(1,1)
  149.     print("Clearing cache...")
  150.     print("Cache cleared.")
  151.     print("Resetting parameters...")
  152.     sleep(.4)
  153.    
  154.     term.clear()
  155.     term.setCursorPos(1,1)
  156.     sleep(.6)
  157.   end
  158. end
  159.  
  160. --Functions
  161. slc = 0
  162. tBarC = 32768
  163. tBartC = 1
  164. backColor = 32768
  165. term.setBackgroundColor(backColor)
  166. term.clear()
  167.  
  168. function titleBar()
  169.   term.setCursorPos(1,1)
  170.   term.setBackgroundColor(tBarC)
  171.   term.setTextColor(tBartC)
  172.   term.clearLine()
  173.   term.setCursorPos(2, 1)
  174.   print("//Start//")
  175. end
  176.  
  177. function drawDesktop()
  178.   term.setBackgroundColor(backColor)
  179.   term.clear()
  180.   term.setCursorPos(47,17)
  181.   term.setTextColor(128)
  182.   print("NhUI")
  183.   term.setCursorPos(2,18)
  184.   term.setTextColor(256)
  185.   print("(Click the menus for more options.)")
  186.   term.setCursorPos(46,18)
  187.   term.setTextColor(128)
  188.   print("v0.1a")
  189.   titleBar()
  190. end
  191.  
  192. function drawMenu1()
  193. term.setTextColor(1)
  194. term.setBackgroundColor(32768)
  195. term.setCursorPos(2,2)
  196. print(">Shutdown")
  197. term.setCursorPos(2,3)
  198. print(">Restart")
  199. term.setCursorPos(2,4)
  200. print(">CraftOS")
  201. end
  202.  
  203. --Desktop
  204. drawDesktop()
  205. while true do
  206.   local event, button, x, y = os.pullEventRaw()
  207.     if slc == 0 then
  208.     if event == "mouse_click" then
  209.       if x>=2 and x<=12 and y==1 and button==1 then
  210.         drawMenu1()
  211.         slc = 1
  212.       else
  213.         drawDesktop()
  214.       end
  215.     end
  216.     elseif slc == 1 then
  217.       if x>=1 and x<=12 and button==1 and y==2 then slc = 0
  218.         os.shutdown()
  219.       elseif x>=1 and x<=12 and y==3 and button==1 then slc = 0
  220.         os.reboot()
  221.       elseif x>=1 and x<=12 and y==4 and button==1 then slc = 0
  222.         term.clear()
  223.         term.setCursorPos(1,1)
  224.         term.setTextColor(16)
  225.         print("CraftOS 1.5 (Ctrl+R will reinitialize NhUI.)")
  226.         term.setTextColor(1)
  227.         break
  228.       else
  229.         slc = 0
  230.         drawDesktop()
  231.      end
  232.   end
  233. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement