Advertisement
Guest User

.Startup

a guest
Feb 26th, 2016
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.96 KB | None | 0 0
  1. term.clear()
  2. term.setCursorPos(1,1)
  3. box(1,1,51,19,Filled,purple)
  4. term.setCursorPos(1,4)
  5. term.setTextColor(black)
  6. print("HydroTech 0.2 Alpha")
  7. box(1,1,51,3,Filled,blue)
  8. term.setBackgroundColor(purple)
  9. term.setTextColor(black)
  10. local function User()
  11.   box(5,8,46,10,Empty,blue)
  12.   line(6,9,45,9,white)
  13.   term.setBackgroundColor(purple)
  14.   interact.centertext("Create Username",7)
  15.   term.setCursorPos(6,9)
  16.   term.setBackgroundColor(white)
  17.   local User = read()
  18.   term.clearLine()
  19.   line(1,9,51,9,purple)
  20.   line(5,9,46,9,blue)
  21.   line(6,9,45,9,white)
  22.   line(1,10,51,10,purple)
  23.   line(5,10,46,10,blue)
  24.   term.setBackgroundColor(purple)
  25.   interact.centertext("Create Password",7)
  26.   term.setBackgroundColor(white)
  27.   term.setCursorPos(6,9)
  28.   local Pass = read()
  29.   box(1,5,51,19,Filled,purple)
  30.   term.setBackgroundColor(purple)
  31.   interact.centertext("Generating User",9)
  32.   local file = fs.open(".User","w")
  33.   file.write(User)
  34.   file.close()
  35.   local file = fs.open(".Pass","w")
  36.   file.write(Pass)
  37.   file.close()
  38.   box(1,5,51,19,Filled,purple)
  39.   interact.centertext("Generated",9)
  40.   interact.centertext("User!",10)
  41.   sleep(1)
  42.   os.reboot()
  43. end
  44. if not fs.exists(".User") then
  45.   if fs.exists(".Pass") then
  46.     fs.delete(".Pass")
  47.     User()
  48.   else
  49.     User()
  50.   end
  51. elseif not fs.exists(".Pass") then
  52.   if fs.exists(".User") then
  53.     fs.delete(".User")
  54.     User()
  55.   else
  56.     User()
  57.   end
  58. else
  59.   line(20,4,20,19,white)
  60.   box(4,6,6,13,Filled,blue)
  61.   box(7,9,8,10,Filled,blue)
  62.   box(9,6,11,13,Filled,blue)
  63.   box(22,6,40,8,Empty,blue)
  64.   line(23,7,39,7,white)
  65.   box(22,10,40,12,Empty,blue)
  66.   line(23,11,39,11,white)
  67.   term.setCursorPos(22,5)
  68.   term.setTextColor(black)
  69.   term.setBackgroundColor(purple)
  70.   print("Enter Username")
  71.   term.setCursorPos(22,9)
  72.   print("Enter Password")
  73.   box(22,14,40,18,Filled,lime)
  74.   term.setCursorPos(28,16)
  75.   print("Confirm")
  76.   while true do
  77.   local event, button, x, y = os.pullEvent("mouse_click")
  78.   term.setCursorPos(1,18)
  79.   print("button "..button.." was pressed at X:"..x.."  Y:"..y)
  80.   if button == 1 then
  81.     local Pass = 0
  82.     local User = 0
  83.     if y > 13 then
  84.       if y < 19 then
  85.         if x > 21 then
  86.           if x < 41 then
  87.           print("ding")
  88.             local Pfile = fs.open(".User","r")
  89.             local Ufile = fs.open(".Pass","r")
  90.             local RPass = Pfile.readLine()
  91.             local RUser = Ufile.readLine()
  92.             local CPass = tostring(RPass)
  93.             local CUser = tostring(RUser)
  94.             if not Pass == CPass then
  95.              if not User == CUser then
  96.                term.setCursorPos(22,5)
  97.                term.setTextColor(red)
  98.                term.setBackgroundColor(purple)
  99.                print("Invalid Username")
  100.                term.setCursorPos(22,9)
  101.                print("Incorrect Password")
  102.                term.setTextColor(black)
  103.              else
  104.                term.setCursorPos(22,9)
  105.                term.setBackgroundColor(purple)
  106.                term.setTextColor(red)
  107.                print("Incorrect Password")
  108.                term.setTextColor(black)
  109.              end
  110.            elseif Pass == CPass then
  111.              if not User == CUser then
  112.                term.setCursorPos(22,9)
  113.                term.setBackgroundColor(purple)
  114.                term.setTextColor(red)
  115.                print("Invalid Username")
  116.                term.setTextColor(black)
  117.              else
  118.                shell.run(".desktop")
  119.              end
  120.            end
  121.           Pfile.close()
  122.           Ufile.close()
  123.           end
  124.         end
  125.       end
  126.     elseif y == 7 then
  127.       if x < 40 then
  128.         if x > 22 then
  129.           term.setCursorPos(23,7)
  130.           term.setBackgroundColor(white)
  131.           local User = read()
  132.         end
  133.       end
  134.     elseif y == 11 then
  135.       if x > 22 then
  136.         if x < 40 then
  137.           term.setBackgroundColor(white)
  138.           term.setCursorPos(23,11)
  139.           local Pass = read("*")
  140.         end
  141.       end
  142.     end
  143.   end
  144. end
  145. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement