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()
- --version
- osName = "Ariana v.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
- --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 m == 1 and x > 1 and x < 16 and y == 2 then
- os.shutdown()
- elseif m == 1 and x > 1 and x < 16 and y == 4 then
- os.reboot()
- elseif m == 1 and x > 1 and x < 16 and y == 6 then
- shell.run(shell.getRunningProgram())
- else
- term.clear()
- mainScreen()
- end
- end
- function drawHeaderForMain()
- setColor(BGC,TC3)
- Reset(1,1)
- paintutils.drawLine(1,1,w,1,BarColor)
- printCentered("-"..osName.."-",1)
- pr("-os-",1,1)
- end
- function mainScreen()
- drawHeaderForMain()
- 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 m == 1 and x > 1 and x < 5 and y == 1 then
- contextMenu()
- elseif m == 2 then
- 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
- mainScreen()
- end
- newe,newm,newx,newy = os.pullEvent("mouse_click")
- if newm == 1 and newx >= x and newx <= x+16 and newy == y then
- shell.run("edit "..shell.getRunningProgram())
- shell.run(shell.getRunningProgram())
- elseif newm == 1 and newx >= x and newx <= x+16 and newy == y+2 then
- shell.run("Browser")
- term.clear()
- mainScreen()
- else
- term.clear()
- mainScreen()
- end
- end
- --Code starts here
- drawHeaderForLogin()
- LoginScreen()
- if Access == true then
- mainScreen()
- end
Advertisement
Add Comment
Please, Sign In to add comment