DigiZA

DigiOS V1.2

Nov 23rd, 2014
205
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.16 KB | None | 0 0
  1. --DigiOS V1.1
  2. --Configurable settings:
  3. slc = 0
  4. tBarC = 8
  5. tBartC = 1
  6. backColor = 1
  7. term.setBackgroundColor(backColor)
  8. xp,yp= term.getSize()
  9. failedlogins = 0
  10. correctpass = "34448252276243"
  11. term.clear()
  12. --Functions
  13. function titleBar()
  14.  term.setCursorPos(1,1)
  15.  term.setBackgroundColor(tBarC)
  16.  term.setTextColor(tBartC)
  17.  term.clearLine()
  18.  term.setCursorPos(3, 1)
  19.  print("[Begin]")
  20. end
  21. function drawDesktop()
  22.  term.setBackgroundColor(backColor)
  23.  term.clear()
  24.  bground = paintutils.loadImage(".background")
  25.  paintutils.drawImage(bground,1,1)
  26.  titleBar()
  27. end
  28. function drawMenu1()
  29.  term.setTextColor(256)
  30.  term.setBackgroundColor(128)
  31.  term.setCursorPos(1,2)
  32.  print("")
  33.  term.setCursorPos(1,3)
  34.  print(" Welcome       ")
  35.  term.setCursorPos(1,4)
  36.  print(" Rules01       ")
  37.  term.setCursorPos(1,5)
  38.  print(" Rules02       ")
  39.  term.setCursorPos(1,6)
  40.  print(" Refresh Files ")
  41.  term.setCursorPos(1,7)
  42.  print(" Shutdown      ")
  43.  term.setCursorPos(1,8)
  44.  print(" Restart       ")
  45.  term.setCursorPos(1,9)
  46.  print("")
  47. end
  48. function Password()
  49.   term.setBackgroundColor(backColor)
  50.   term.clear()
  51.   bground = paintutils.loadImage(".background")
  52.   paintutils.drawImage(bground,1,1)
  53.   term.setCursorPos(1,(yp-2))
  54.   print("Please enter Password:")
  55.   pass = read("*")
  56.  if pass == correctpass then
  57.   drawDesktop()
  58.   DigiOS()
  59.  elseif failedlogins =< 3 then
  60.   failedlogins = failedlogins+1
  61.   Password()
  62.  elseif failedlogins => 3
  63.   term.setBackgroundColor(backColor)
  64.   term.clear()
  65.   bground = paintutils.loadImage(".denied")
  66.   term.setCursorPos(1,(yp-2))
  67.   print("Password incorrect… System lock down…")
  68.   sleep(120)
  69.  end
  70. end
  71. function DigiOS()
  72. while true do
  73. local event, button, X, Y = os.pullEventRaw()
  74.  if slc == 0 then
  75.    if event == "mouse_click" then
  76. if X >=2 and X <=8 and Y==1 and button ==1 then
  77. drawMenu1()
  78. slc = 1
  79.   else
  80.   drawDesktop()
  81. end
  82.    end
  83.   elseif slc == 1 then
  84. if X >=1 and X <=11 and button == 1 and Y== 3 then slc = 0
  85.   if fs.exists("welcome") then
  86.    shell.run("welcome")
  87.   else
  88.    shell.run("delete", "welcome")
  89.    shell.run("pastebin", "get", "9RquCUTX", "welcome")
  90.    shell.run("welcome")
  91.   end
  92.  elseif X>=1 and X<=11 and Y==4 and button ==1 then slc = 0
  93.   if fs.exists("Rules01") then
  94.    shell.run("Rules01")
  95.   else
  96.    shell.run("delete", "Rules01")
  97.    shell.run("pastebin", "get", "mCWmYwSi", "Rules01")
  98.    shell.run("Rules01")
  99.   end
  100.  elseif X>=1 and X<=11 and Y==5 and button ==1 then slc = 0
  101.   if fs.exists("Rules02") then
  102.    shell.run("Rules02")
  103.   else
  104.    shell.run("delete", "Rules02")
  105.    shell.run("pastebin", "get", "Kjb5jyfB", "Rules02")
  106.    shell.run("Rules02")
  107.   end
  108.  elseif X>=1 and X<=11 and Y==6 and button ==1 then slc = 0
  109.   shell.run("delete", "welcome")
  110.   shell.run("delete", "Rules01")
  111.   shell.run("delete", "Rules02")
  112.   shell.run("pastebin", "get", "9RquCUTX", "welcome")
  113.   shell.run("pastebin", "get", "mCWmYwSi", "Rules01")
  114.   shell.run("pastebin", "get", "Kjb5jyfB", "Rules02")
  115.  elseif X>=1 and X<=11 and Y==7 and button ==1 then slc = 0
  116.   os.shutdown()
  117.  elseif X>=1 and X<=11 and Y==8 and button ==1 then slc = 0
  118.   os.reboot()
  119.  else
  120.  slc = 0
  121.  drawDesktop()
  122. end
  123. end
  124. end
  125. end
  126.  
  127. --DigiOS
  128. Password()
Advertisement
Add Comment
Please, Sign In to add comment