Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- oldPull = os.pullEvent;
- os.pullEvent = os.pullEventRaw;
- --Information about the OS is stored here--
- version = 0.8
- --Variables
- w, h = term.getSize()
- ---Colors
- blue = colors.blue
- black = colors.black
- white = colors.white
- red = colors.red
- yellow = colors.yellow
- lightBlue = colors.lightBlue
- lightGray = colors.lightGray
- green = colors.green
- lime = colors.lime
- pink = colors.pink
- purple = colors.purple
- magenta = colors.magenta
- gray = colors.gray
- brow = colors.brown
- cyan = colors.cyan
- orange = colors.orange
- --Functions
- function clear()
- term.clear()
- end
- function setBackgroundColor(...)
- term.setBackgroundColor(...)
- term.clear()
- end
- function clearLine(y, c)
- term.setCursorPos(1,y)
- term.setBackgroundColor(c)
- term.clearLine()
- end
- function setTextColor(...)
- term.setTextColor(...)
- end
- function printCenter(y, s)
- local x = math.floor((w - string.len(s))/2)
- term.setCursorPos(x,y)
- write(s)
- end
- function slowPrint(...)
- textutils.slowPrint(...)
- end
- function slowWrite(...)
- textutils.slowWrite(...)
- end
- function setCursorPos(x, y)
- term.setCursorPos(x,y)
- end
- function background(...)
- term.setBackgroundColor(...)
- end
- function drawImage(x,y,s)
- paintutils.drawImage(paintutils.loadImage(s),x,y)
- end
- --Program starts
- oldPull = os.pullEvent;
- os.pullEvent = os.pullEventRaw;
- sett = true
- animation = true
- bc = lightBlue
- _x = 4
- tmsts = 0
- local buc = white
- local tc = black
- local main = true
- local _num = 0
- local _tm = 0
- function _update()
- _open = fs.open("/privacy/password","r")
- opw = tostring(_open.readLine())
- _open.close()
- end
- _update()
- local pwc = {}
- pwc[1] = false
- pwc[2] = false
- pwc[3] = false
- function slide()
- drawDesktop()
- repeat
- _x = _x + 8
- drawImage(_x, 2,"/swfiles/animations/window")
- sleep(0.03)
- drawDesktop()
- until _x >= 52
- bc = white
- drawDesktop()
- shell.run("/swfiles/ACEOS.lua")
- end
- function drawDesktop()
- setBackgroundColor(bc)
- clearLine(19,lightGray)
- background(buc)
- setTextColor(tc)
- setCursorPos(1,19)
- write("[|]")
- end
- function drawSetting()
- if animation == true then
- drawDesktop()
- drawImage(1,1,"/swfiles/animations/window2")
- sleep(0.1)
- drawDesktop()
- drawImage(1,1,"/swfiles/animations/window3")
- sleep(0.1)
- drawDesktop()
- drawImage(4,2,"/swfiles/animations/window")
- elseif animation == false then
- drawDesktop()
- drawImage(4,2,"/swfiles/animations/window")
- end
- if tmsts == 0 then
- background(red)
- setTextColor(white)
- setCursorPos(47,2)
- print("x")
- setCursorPos(5, 2)
- background(lightGray)
- setTextColor(gray)
- print("Settings")
- setCursorPos(5, 4)
- setTextColor(blue)
- background(white)
- print("Users")
- elseif tmsts == 1 then
- background(red)
- setTextColor(white)
- setCursorPos(47,2)
- print("x")
- setCursorPos(5,2)
- background(lightGray)
- setTextColor(gray)
- print("Settings/Users")
- setCursorPos(43,2)
- print("<--")
- setCursorPos(5,4)
- setTextColor(blue)
- background(white)
- print("Change username")
- setCursorPos(5,5)
- print("Change password")
- end
- end
- function drawPopupUN()
- setCursorPos(20,4)
- setTextColor(gray)
- background(lightGray)
- print("Popup")
- setCursorPos(32,4)
- setTextColor(white)
- background(red)
- print("x")
- background(white)
- setTextColor(black)
- setCursorPos(20,5)
- print("Old Username:")
- local h = fs.open("/privacy/username","r")
- local oun = h.readLine()
- h.close()
- setCursorPos(22,6)
- background(lightBlue)
- print(oun)
- setCursorPos(20,7)
- background(white)
- print("New Username:")
- end
- function drawPopupPS()
- setCursorPos(20,4)
- setTextColor(gray)
- background(lightGray)
- print("Popup")
- setCursorPos(32,4)
- setTextColor(white)
- background(red)
- print("x")
- background(white)
- setTextColor(black)
- setCursorPos(20,5)
- print("Old Password:")
- setCursorPos(20,7)
- print("New Password:")
- setCursorPos(20,9)
- print("Repeat:")
- end
- drawSetting()
- --Loop
- while sett == true do
- local event, button, X, Y = os.pullEventRaw()
- if event == "mouse_click" then
- if main == true then
- if X==47 and Y==2 and button == 1 then
- drawDesktop()
- drawImage(1,1,"/swfiles/animations/window3")
- sleep(0.1)
- drawDesktop()
- drawImage(1,1,"/swfiles/animations/window2")
- sleep(0.1)
- drawDesktop()
- shell.run("/swfiles/ACEOS.lua")
- break
- end
- if X>=1 and X<=52 and Y==1 and button == 1 then
- slide()
- break
- elseif X>=1 and X<=3 and Y>=1 and Y<=19 and button == 1 then
- slide()
- break
- elseif X>=1 and X<=52 and Y>=17 and Y<=19 and button == 1 then
- slide()
- break
- elseif X>=48 and X<=52 and Y>=1 and Y<=19 and button == 1 then
- slide()
- break
- end
- end
- if tmsts == 0 then
- if X>=5 and X<=10 and Y==4 and button==1 then
- background(lightBlue)
- setCursorPos(5,4)
- setTextColor(white)
- print("Users")
- pcall(sleep,0.1)
- tmsts = 1
- animation = false
- drawSetting()
- animation = true
- end
- elseif tmsts == 1 then
- if X>=43 and X<=45 and Y==2 and button == 1 then
- animation = false
- tmsts = 0
- drawSetting()
- animation = true
- elseif X>=5 and X<=20 and Y==4 and button == 1 then
- setCursorPos(5,4)
- background(lightBlue)
- setTextColor(white)
- print("Change username")
- sleep(0.1)
- setBackgroundColor(black)
- drawImage(20,4,"/swfiles/animations/popup")
- drawPopupUN()
- main = false
- tmsts = 2
- elseif X>=5 and X<=20 and Y==5 and button == 1 then
- setCursorPos(5,5)
- background(lightBlue)
- setTextColor(white)
- print("Change password")
- sleep(0.1)
- setBackgroundColor(black)
- drawImage(20,4,"/swfiles/animations/popup2")
- drawPopupPS()
- tmsts = 3
- end
- elseif tmsts == 2 then
- if X==32 and Y==4 and button == 1 then
- animation = false
- tmsts = 1
- main = true
- drawSetting()
- animation = true
- elseif X>=22 and X<=31 and Y==8 and button == 1 then
- setCursorPos(22,8)
- background(lightBlue)
- setTextColor(black)
- local user = read()
- if user == "" then
- user = " "
- end
- local _u = fs.open("/privacy/username","w")
- _u.write(user)
- _u.close()
- animation = false
- tmsts = 1
- main = true
- drawSetting()
- animation = true
- end
- elseif tmsts == 3 then
- if X>=21 and X<=31 and Y==6 and button == 1 then
- _num = 0
- if _num == 0 then
- setCursorPos(21,6)
- background(lightBlue)
- write(" ")
- setCursorPos(20,11)
- background(white)
- setTextColor(red)
- print(" ")
- background(lightBlue)
- setTextColor(gray)
- setCursorPos(21,6)
- _pass = read("*")
- if _pass == opw then
- _num = 1
- pwc[1] = true
- if pwc[1] == true and pwc[2] == true and pwc[3] == true then
- local np = fs.open("/privacy/password","w")
- np.write(_npass)
- np.close()
- animation = false
- tmsts = 1
- drawSetting()
- animation = true
- pwc = {false,false,false}
- _update()
- end
- else
- _num = 0
- background(lightBlue)
- setCursorPos(21,6)
- write(" ")
- setTextColor(red)
- background(white)
- setCursorPos(20,11)
- print("Wrong O.PWord")
- end
- end
- elseif X>=21 and X<=31 and Y==8 and button == 1 then
- setCursorPos(21,8)
- background(lightBlue)
- write(" ")
- setCursorPos(20,11)
- background(white)
- setTextColor(red)
- print(" ")
- setCursorPos(21,8)
- background(lightBlue)
- setTextColor(gray)
- _npass = read("*")
- if string.len(_npass) >= 9 then
- setTextColor(red)
- background(white)
- setCursorPos(20,11)
- print("Only 8 chara.")
- setCursorPos(21,8)
- background(lightBlue)
- write(" ")
- pwc[2] = false
- else
- pwc[2] = true
- end
- elseif X>=21 and X<=31 and Y==10 and button == 1 then
- setCursorPos(21,10)
- background(lightBlue)
- write(" ")
- setCursorPos(20,11)
- background(white)
- setTextColor(red)
- print(" ")
- setCursorPos(21,10)
- background(lightBlue)
- setTextColor(gray)
- _rpass = read("*")
- if string.len(_rpass) >= 9 then
- setTextColor(red)
- background(white)
- setCursorPos(20,11)
- print("Only 8 chara.")
- setCursorPos(21,8)
- background(lightBlue)
- write(" ")
- pwc[2] = false
- else
- if _npass == _rpass then
- pwc[3] = true
- if pwc[1] == true and pwc[2] == true and pwc[3] == true then
- local np = fs.open("/privacy/password","w")
- np.write(_npass)
- np.close()
- animation = false
- tmsts = 1
- drawSetting()
- animation = true
- pwc = {false,false,false}
- _update()
- end
- else
- background(lightBlue)
- setCursorPos(21,10)
- write(" ")
- background(white)
- setTextColor(red)
- setCursorPos(20,11)
- print("Wrong repeat")
- pwc[3] = false
- end
- end
- elseif X==32 and Y==4 and button == 1 then
- animation = false
- tmsts = 1
- drawSetting()
- animation = true
- end
- end
- end
- end
- os.pullEvent = oldPull;
Add Comment
Please, Sign In to add comment