Advertisement
Guest User

startup

a guest
Oct 23rd, 2014
153
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.48 KB | None | 0 0
  1. colored = true
  2.  
  3. if term.isColour() then
  4.   print("Terminal is colored.")
  5.   sleep(.1)
  6.   colored = true
  7. else
  8.   error("Terminal not colored.")
  9. end
  10.  
  11. password = {
  12.   username = "icarus";
  13.   password = "machina";
  14. }
  15.  
  16. function SPixel(x,y,color)
  17.   term.setCursorPos(x,y); term.setTextColour(color)
  18.   term.setBackgroundColour(color); term.write("d")
  19.   term.setTextColour(colours.white); term.setBackgroundColour(colours.black)
  20. end
  21.  
  22. function SPixelText(x,y,color,textcol,b)
  23.   term.setCursorPos(x,y); term.setTextColour(textcol)
  24.   term.setBackgroundColour(color); term.write(b)
  25.   term.setTextColour(colours.white); term.setBackgroundColour(colours.black)
  26. end
  27.  
  28. term.clear()
  29. term.setCursorPos(1,1)
  30.  
  31. function login_colored()
  32.   term.clear()
  33.   term.setCursorPos(1,1)
  34.   for i=1, 51 do
  35.     SPixel(i,1,colours.grey)
  36.   end
  37.    SPixelText(1,1,colours.grey,colours.white,"Daedalus:GlobalNode:MAJESTIC//GLOBAL//12.11/Login")
  38.  SPixelText(1,2,colours.red,colours.white,"Welcome to MJ12 Net-Please login")
  39.    term.setCursorPos(1,3)
  40.   io.write("Username: ")
  41.   local uName = read()
  42.   io.write("Password: ")
  43.   local pWord = read("*")
  44.   if(uName == password.username and pWord == password.password) then
  45.     term.clear()
  46.     term.setCursorPos(1,1)
  47.     return
  48.   elseif(uName ~= password.username and pWord ~= password.password) then
  49.     term.setCursorPos(1,19)
  50.     SPixelText(1,19,colours.black,colours.red,"Wrong password. Redirecting...")
  51.     sleep(2)
  52.     login_colored()
  53.   end
  54. end
  55.  
  56. login_colored()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement