Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- os.pullEvent = os.pullEventRaw
- local fle = fs.open("DankOs/.version","r")
- local Ver = fle.readLine()
- fle.close()
- local w,h = term.getSize()
- function printCentered( y,s )
- local x = math.floor((w - string.len(s)) / 2)
- term.setCursorPos(x,y)
- term.clearLine()
- term.write( s )
- end
- local nOption = 1
- local function drawMenu()
- term.clear()
- term.setCursorPos(1,1)
- term.write("Dank Os alpha "..Ver.."// ")
- term.setCursorPos(1,2)
- shell.run("id")
- term.setCursorPos(w-11,1)
- if nOption == 1 then
- term.write("messegeBoard")
- elseif nOption == 2 then
- term.write("SendFile")
- elseif nOption == 3 then
- term.write("GetFile")
- elseif nOption == 4 then
- term.write("install a program")
- elseif nOption == 5 then
- term.write("uninstall a program")
- elseif nOption == 6 then
- term.write("Back")
- else
- end
- end
- --GUI
- term.clear()
- local function drawFrontend()
- printCentered( math.floor(h/2) - 3, "")
- printCentered( math.floor(h/2) - 2, "Programs" )
- printCentered( math.floor(h/2) - 1, "")
- printCentered( math.floor(h/2) + 0, ((nOption == 1) and "[ MessegeBoard ]") or "MessegeBoard" )
- printCentered( math.floor(h/2) + 1, ((nOption == 2) and "[ SendFile ]") or "SendFile" )
- printCentered( math.floor(h/2) + 2, ((nOption == 3) and "[ GetFile ]") or "GetFile" )
- printCentered( math.floor(h/2) + 3, ((nOption == 4) and "[ install a program ]")or "install a program" )
- printCentered( math.floor(h/2) + 4, ((nOption == 5) and "[ uninstall a program ]")or"uninstall a program")
- printCentered( math.floor(h/2) + 5, ((nOption == 6) and "[ Back ]") or "Back" )
- printCentered( math.floor(h/2) + 6, "")
- end
- --Display
- drawMenu()
- drawFrontend()
- while true do
- local e,p = os.pullEvent()
- if e == "key" then
- local key = p
- if key == 17 or key == 200 then
- if nOption > 1 then
- nOption = nOption - 1
- drawMenu()
- drawFrontend()
- end
- elseif key == 31 or key == 208 then
- if nOption < 6 then
- nOption = nOption + 1
- drawMenu()
- drawFrontend()
- end
- elseif key == 28 then
- --End should not be here!!
- break
- end --End should be here!!
- end
- end
- term.clear()
- --Conditions
- if nOption == 1 then
- shell.run("DankOs/.Message")
- elseif nOption == 2 then
- shell.run("DankOs/.sendFile")
- elseif nOption == 3 then
- shell.run("DankOs/.getFile")
- elseif nOption == 4 then
- shell.run("DankOs/.installProgram")
- elseif nOption == 5 then
- shell.run("DankOs/.uninstallProgram")
- else
- shell.run(".menu")
- end
Add Comment
Please, Sign In to add comment