Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[
- This os named Ariana v.1 is made
- by Awesomesause200 you are allowed to edit this
- code but you cannot
- redistribute without my prior allowance
- ]]--
- --for printing functions
- w,h = term.getSize()
- --for skipping login screen
- tArgs = {...}
- --version
- osName = "Ariana v.1.1"
- --Username and passwords
- Usernames = {"Someone","guest"}
- Passwords = {"Someone","guest"}
- --Access to Computer
- Access = false
- --Colors for stuff
- BGC = colors.black
- TC = colors.white
- TC2 = colors.blue
- TC3 = colors.lightGray
- BarColor = colors.blue
- ContextMenuColor1 = colors.lightBlue
- ContextMenuTextColor1 = colors.black
- --selection menu
- slc = 1
- --icons for use
- fileExplore = "os/icon1"
- --printing functions
- --Some learned from nitrofingers
- function printCentered(str,ypos)
- term.setCursorPos(w/2 - #str/2,ypos)
- term.write(str)
- end
- function printRight(str,ypos)
- term.setCursorPos(w-#str,ypos)
- term.write(str)
- end
- function pr(str,x,y)
- term.setCursorPos(x,y)
- term.write(str)
- end
- --Extra functions
- function Reset(x,y)
- term.clear()
- term.setCursorPos(x,y)
- end
- function setColor(Backgroundcolor,Textcolor)
- term.setBackgroundColor(Backgroundcolor)
- term.setTextColor(Textcolor)
- end
- function drawHeaderForLogin()
- setColor(BGC,TC)
- term.clear()
- paintutils.drawLine(1,1,w,1,BarColor)
- printCentered("- welcome to "..osName.."-",1)
- end
- function LoginScreen()
- setColor(BGC,TC2)
- printCentered("Username: ",h/2-1)
- printCentered("Password: ",h/2+1)
- printRight("Guest account:",h-2)
- printRight("User = guest ",h-1)
- printRight("Pass = guest ",h)
- term.setCursorPos(w/2 + 4,h/2-1)
- User = read()
- term.setCursorPos(w/2 + 4,h/2+1)
- Pass = read()
- for i = 1,#Usernames do
- if Usernames[i] == User then
- if Passwords[i] == Pass then
- Access = true
- end
- end
- end
- end
- function contextMenu()
- setColor(ContextMenuColor1,ContextMenuTextColor1)
- term.setCursorPos(1,2)
- print("Shutdown")
- print(" ")
- print("Restart ")
- print(" ")
- print("Logoff ")
- e,m,x,y = os.pullEvent("mouse_click")
- if slc == 2 and m == 1 and x > 1 and x < 9 and y == 2 then
- os.shutdown()
- elseif slc == 2 and m == 1 and x > 1 and x < 9 and y == 4 then
- os.reboot()
- elseif slc == 2 and m == 1 and x > 1 and x < 9 and y == 6 then
- shell.run(shell.getRunningProgram())
- else
- term.clear()
- slc = 1
- mainScreen()
- end
- end
- function drawHeaderForMain()
- setColor(BGC,TC3)
- Reset(1,1)
- paintutils.drawLine(1,1,w,1,BarColor)
- printCentered("-Welcome "..User.."-",1)
- pr("-os-",1,1)
- icon1_load = paintutils.loadImage(fileExplore)
- paintutils.drawImage(icon1_load,3,4)
- setColor(BGC,TC3)
- end
- function mainScreen()
- drawHeaderForMain()
- setColor(BarColor,TC3)
- parallel.waitForAny(
- function()
- while true do
- term.setCursorPos(w-8,1)
- print(textutils.formatTime(os.time()))
- sleep(1)
- term.setCursorPos(w-8,1)
- print(" ")
- end
- end,
- function()
- e,m,x,y = os.pullEvent("mouse_click")
- end
- )
- if slc == 1 and m == 1 and x > 1 and x < 5 and y == 1 then
- slc = 2
- contextMenu()
- elseif slc == 1 and m == 1 and x >= 3 and x <= 19 and y == 4 or y == 5 or y == 6 or y== 7 or y == 8 or y == 9 or y == 10 then
- shell.run("Browser")
- shell.run(shell.getRunningProgram())
- elseif slc == 1 and m == 2 and x < 38 then
- slc = 3
- term.setCursorPos(x,y)
- print("Edit ariana v.1")
- y = y+1
- term.setCursorPos(x,y)
- print(" ")
- y = y+1
- term.setCursorPos(x,y)
- print("Explore files ")
- y = y-2
- else
- slc = 1
- mainScreen()
- end
- newe,newm,newx,newy = os.pullEvent("mouse_click")
- if slc == 3 and newm == 1 and newx >= x and newx <= x+16 and newy == y then
- shell.run("edit "..shell.getRunningProgram())
- shell.run(shell.getRunningProgram())
- elseif slc == 3 and newm == 1 and newx >= x and newx <= x+16 and newy == y+2 then
- shell.run("Browser")
- term.clear()
- slc = 1
- mainScreen()
- else
- term.clear()
- slc = 1
- mainScreen()
- end
- end
- --Code starts here
- if tArgs[1] then
- Access = true
- User = "guest"
- else
- drawHeaderForLogin()
- LoginScreen()
- end
- if Access == true then
- mainScreen()
- end
Advertisement
Add Comment
Please, Sign In to add comment