Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --$$ AOS (Advanced Opperating System) $$--
- --## Just Does Games ##--
- --## 9/24/2019 @ 3:10 PM ##--
- if not term.isColor() then print("Advanced Computer Required!") return end
- local sx,sy = term.getSize()
- if sx ~= 51 or sy ~= 19 then print("51 by 19 required. got "..sx.." by "..xy) return end
- shell.run("cd /")
- -- Pre-established Functions --
- function setText(col)
- term.setTextColor(colors[col])
- end
- function setBack(col)
- term.setBackgroundColor(colors[col])
- end
- function cp(x,y)
- term.setCursorPos(x,y)
- end
- function clr()
- term.clear()
- end
- if not fs.exists("AOS_missingno.nfp") then
- local missingno = {"2f2f2","f2f2f7","2f2f27"," 77777"}
- local file = fs.open("AOS_missingno.nfp", "w")
- for i=1, #missingno do
- file.writeLine(missingno[i])
- end
- file.close()
- end
- -- Functions --
- function display_bar()
- cp(1,sy) setBack("green") write(" ") setBack("white") for i=1, sx-1 do write(" ") end cp(2,2)
- end
- function display_ico(delay)
- -- icons are 6 x 4
- --local temp = paintutils.loadImage("os/AOS/ico/temp.nfp")
- local varia = 0
- local raw_count = 1
- setText("white")
- for i=1, 3 do -- top to bottom
- local varib = 0
- for j=1, 7 do -- left to right
- if menu_selected[raw_count] ~= nil then
- paintutils.drawImage(menu_selected[raw_count][1], (7-5)+(7*varib), (7-5)+(6*varia))
- cp((7-5)+(7*varib), (7-5)+(6*varia)+4)
- setBack("cyan")
- write(menu_selected[raw_count][2])
- if delay == nil then sleep(.0000001) end
- end
- varib = varib + 1
- raw_count = raw_count + 1
- end
- varia = varia + 1
- end
- end
- function display_start()
- for i=1, #menu_start do
- if start_menu_open == true then
- setBack(menu_start[i][1])
- else
- setBack("cyan")
- end
- cp(1,sy-#menu_start+i-1)
- for i=1, 10 do
- write(" ")
- end
- if start_menu_open == true then
- setBack("lightGray")
- write(" ")
- setBack(menu_start[i][1])
- else
- write(" ")
- end
- end
- if start_menu_open == true then
- for i=1, #menu_start do
- cp(1,sy-#menu_start+i-1)
- setText(menu_start[i][2])
- setBack(menu_start[i][1])
- write(menu_start[i][3])
- end
- end
- if start_menu_open == false then
- display_ico(false)
- end
- end
- function display(icos)
- setBack("cyan") clr() display_bar() if icos == nil then display_ico(false) else if icos == true then display_ico() end end
- end
- function checkClick(x,y)
- if x ~= 1 and x ~= sx-1 and x ~= sx and y ~= 1 then
- if x ~= 8 and x ~= 15 and x ~= 22 and x ~= 29 and x ~= 36 and x ~= 43 and y ~= 7 and y ~= 13 then
- if x >= 44 then
- if y >= 14 then
- -- 21
- lastClick = "click_21"
- elseif y >= 8 then
- -- 20
- lastClick = "click_14"
- elseif y >= 2 then
- -- 19
- lastClick = "click_7"
- else
- lastClick = false
- end
- elseif x >= 37 then
- if y >= 14 then
- -- 18
- lastClick = "click_20"
- elseif y >= 8 then
- -- 17
- lastClick = "click_13"
- elseif y >= 2 then
- -- 16
- lastClick = "click_6"
- else
- lastClick = false
- end
- elseif x >= 30 then
- if y >= 14 then
- -- 15
- lastClick = "click_19"
- elseif y >= 8 then
- -- 14
- lastClick = "click_12"
- elseif y >= 2 then
- -- 13
- lastClick = "click_5"
- else
- lastClick = false
- end
- elseif x >= 23 then
- if y >= 14 then
- -- 12
- lastClick = "click_18"
- elseif y >= 8 then
- -- 11
- lastClick = "click_11"
- elseif y >= 2 then
- -- 10
- lastClick = "click_4"
- else
- lastClick = false
- end
- elseif x >= 16 then
- if y >= 14 then
- -- 9
- lastClick = "click_17"
- elseif y >= 8 then
- -- 8
- lastClick = "click_10"
- elseif y >= 2 then
- -- 7
- lastClick = "click_3"
- else
- lastClick = false
- end
- elseif x >= 9 then
- if y >= 14 then
- -- 6
- lastClick = "click_16"
- elseif y >= 8 then
- -- 5
- lastClick = "click_9"
- elseif y >= 2 then
- -- 4
- lastClick = "click_2"
- else
- lastClick = false
- end
- elseif x >= 2 then
- if y >= 14 then
- -- 3
- lastClick = "click_15"
- elseif y >= 8 then
- -- 2
- lastClick = "click_8"
- elseif y >= 2 then
- -- 1
- lastClick = "click_1"
- else
- lastClick = false
- end
- else
- lastClick = false
- end
- end
- end
- end
- function openWindow()
- display(false) paintutils.drawImage(window,1,1)
- end
- function icon_check(location)
- if not fs.exists(location) then
- return paintutils.loadImage("AOS_missingno.nfp")
- else
- return paintutils.loadImage(location)
- end
- end
- -- Menus and Variables --
- menu_start = {{"red", "white", "Shutdown"}, {"orange", "white", "Reboot"}, {"yellow", "white", "Shell"}}
- menu_main = {{icon_check("/os/AOS/ico/apps.nfp"), "Apps"}, {icon_check("/os/AOS/ico/help.nfp"), "Help"}}
- menu_apps = {{icon_check("/os/AOS/ico/naiv_back.nfp"), "..."}, {icon_check("/os/AOS/ico/file_system.nfp"), "Files"}, {icon_check("/os/AOS/ico/paint.nfp"), "Paint"}, {icon_check("/os/AOS/ico/ico_maker.nfp"), "ico maker"}}
- -- 6 x 4 icons
- menu_selected = menu_main
- start_menu_open = false
- window = paintutils.loadImage("/os/AOS/ico/window.nfp")
- lastClick = false
- -- Runtime --
- function runtime()
- display()
- running = true
- local x,y = 1,1
- while running do
- sleep(.01)
- a,b,x,y = os.pullEvent("mouse_click") setText("black") setBack("white") cp(sx-13,sy) write("X: "..x.." Y: "..y.." ")
- if x == 1 and y == sy then
- if start_menu_open == true then start_menu_open = false else start_menu_open = true end display_start()
- elseif x <= 10 and y >= sy-#menu_start and start_menu_open == true then -- Start menu
- if y == 16 then
- os.shutdown()
- elseif y == 17 then
- os.reboot()
- elseif y == 18 then
- setBack("black") clr() cp(1,1) running = false
- end
- else -- anything other than start menu shit
- if start_menu_open == true then start_menu_open = false display_start() end
- checkClick(x,y)
- if lastClick ~= false then
- if menu_selected == menu_main then
- if lastClick == "click_1" then
- menu_selected = menu_apps display(true)
- elseif lastClick == "click_2" then
- lastClick = false
- openWindow()
- cp(4,4)
- setText("black") setBack("white")
- print("AOS (Advanced Opperating System) is an OS use")
- cp(4,5)
- print("to increase usage of any Advanced Computer.")
- local lx,ly = 1,1
- repeat
- a,b,lx,ly = os.pullEvent("mouse_click")
- until lx == sx-3 and ly == 2 or lx == sx-4 and ly == 2
- display()
- end
- elseif menu_selected == menu_apps then
- if lastClick == "click_1" then
- menu_selected = menu_main display(true)
- elseif lastClick == "click_2" then
- --
- elseif lastClick == "click_3" then
- --
- elseif lastClick == "click_4" then
- --
- end
- end
- end
- end
- end
- end
- runtime()
Advertisement
Add Comment
Please, Sign In to add comment