Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- term.clear()
- term.setCursorPos(1,1)
- local version = "0.1"
- --Color Set Functions--
- function white()
- term.setTextColor(1)
- end
- function yellow()
- term.setTextColor(16)
- end
- function blue()
- term.setTextColor(2048)
- end
- function green()
- term.setTextColor(8192)
- end
- function red()
- term.setTextColor(16384)
- end
- function black()
- term.setTextColor(32768)
- end
- --Text Functions
- function drawLine()
- print("---------------------------------------------------")
- end
- function centerText(text)
- local x,y = term.getSize()
- local x2,y2 = term.getCursorPos()
- term.setCursorPos(math.ceil((x / 2) - (text:len() / 2)), y2)
- write(text)
- end
- function drawLogo(text)
- red()
- drawLine()
- white()
- centerText(text)
- red()
- drawLine()
- white()
- end
- function drawSubLogo(text)
- centerText(text)
- red()
- drawLine()
- white()
- end
- function clear()
- term.clear()
- term.setCursorPos(1,1)
- end
- function press()
- red()
- centerText("~")
- yellow()
- centerText("Press anything to continue!")
- white()
- os.pullEvent("key")
- end
- --Main Programs
- function drawMain()
- clear()
- drawLogo("StriteOS")
- drawSubLogo("~Version "..version.."!~")
- print()
- yellow()
- write("> ")
- white()
- local com = read()
- if com == "Redstone" or "redstone" or "rs" then
- redstone()
- elseif com == "Exit" or "exit" or "Out" or "out" then
- exit()
- end
- end
- function redstone()
- print ("Function not done, try again later!")
- print ()
- press()
- drawMain()
- end
- function exit()
- term.clear()
- term.setCursorPos(1,1)
- drawLogo("StriteOS")
- drawSubLogo("Are you sure you want to exit StriteOS? (y/n)")
- print()
- yellow()
- write("> ")
- white()
- local exitYN = read()
- if exitYN == "y" or "Y" or "yes" or "YES" or "Yes" then
- term.clear()
- term.setCursorPos(1,1)
- drawLogo("StriteOS")
- drawSubLogo("Exiting StriteOS...")
- sleep(0.8)
- shell.run("reboot")
- elseif exitYN == "n" or "N" or "No" or "NO" or "No" then
- term.clear()
- term.setCursorPos(1,1)
- drawLogo("StriteOS")
- drawSubLogo("Going back to Desktop...")
- sleep(0.8)
- drawMain()
- end
- end
- --Main
- drawMain()
Advertisement
Add Comment
Please, Sign In to add comment