Advertisement
Guest User

os

a guest
Mar 28th, 2015
192
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.32 KB | None | 0 0
  1. dropdown=0
  2. login=0
  3. term.clear()
  4. function login()
  5.   term.setBackgroundColor(colors.black)
  6.   term.clear()
  7.   term.setBackgroundColor(colors.orange)
  8.   term.setCursorPos(10, 6)
  9.   term.write("       ")
  10.   term.setBackgroundColor(colors.cyan)
  11.   term.setCursorPos(10, 7)
  12.   term.write(" 1 2 3 ")
  13.   term.setCursorPos(10, 8)
  14.   term.write(" 4 5 6 ")
  15.   term.setCursorPos(10, 9)
  16.   term.write(" 7 8 9 ")
  17.   term.setCursorPos(10, 10)
  18.   term.setBackgroundColor(colors.green)
  19.   term.write("    ")
  20.   term.setCursorPos(14, 10)
  21.   term.setBackgroundColor(colors.red)
  22.   term.write("   ")
  23. end
  24. function background()
  25.   term.setBackgroundColor(colors.cyan)
  26.   term.clear()
  27. end
  28. function t_bar()
  29.   term.setCursorPos(1, 1)
  30.   term.setBackgroundColor(8)
  31.   term.setTextColor(1)
  32.   term.clearLine()
  33.   term.setCursorPos(3, 1)
  34.   print("[OS]")
  35. end
  36. function dropDown()
  37.   term.setBackgroundColor(colors.gray)
  38.   term.setCursorPos(1, 2)
  39.   print("            ")
  40.   term.setCursorPos(1, 3)
  41.   print("  Shutdown  ")
  42.   term.setCursorPos(1, 4)
  43.   print("  Restart   ")
  44.   term.setCursorPos(1, 5)
  45.   print("  Logout    ")
  46.   term.setCursorPos(1, 6)
  47.   print("            ")
  48. end
  49. function menu()
  50.   term.setCursorPos(1, 4)
  51.   term.setBackgroundColor(colors.black)
  52.   print("          ")
  53.   term.setCursorPos(1, 14)
  54.   print("          ")
  55.   for i=1, 9 do
  56.     term.setCursorPos(1, i+4)
  57.     print(" ")
  58.     term.setCursorPos(10, i+4)
  59.     print(" ")
  60.   end
  61.   --options
  62.   term.setBackgroundColor(colors.cyan)
  63.   term.setCursorPos(3, 6)
  64.   print("Devil")
  65.   term.setCursorPos(3, 7)
  66.   print("Teddy")
  67. end
  68. login()
  69. while true do
  70.   --update
  71.   local event, button, X, Y = os.pullEventRaw()
  72.   if button==1 and X==51 and Y==1 then error() end
  73.   if login==0 then
  74.    
  75.   end
  76.   if login==1 then
  77.     if Y==1 and X>=3 and X<=6 and button==1 then
  78.       if dropdown==0 then dropdown=1
  79.       else dropdown=0 end
  80.     end
  81.     if dropdown==1 then
  82.       if Y==3 and X>=3 and X<=12 and button==1 then os.shutdown() end
  83.       if Y==4 and X>=3 and X<=12 and button==1 then os.reboot() end
  84.       if Y==5 and X>=3 and X<=12 and button==1 then
  85.         term.setBackgroundColor(colors.black)
  86.         term.clear()
  87.         term.setCursorPos(1, 1)
  88.         error()
  89.       end
  90.     end
  91.  
  92.     --draw
  93.     background()
  94.     t_bar()
  95.     menu()
  96.     if dropdown==1 then dropDown() end
  97.   end
  98. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement