Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- os.pullEvent = os.pullEventRaw
- --Load Config Data.--
- function load(name)
- local file = fs.open(name,"r")
- local data = file.readAll()
- file.close()
- return textutils.unserialize(data)
- end
- --Set the Computer name variable from Config--
- function LoadName()
- local config = load("RobcOS_ticket")
- return config[1]
- end
- --CONFIG SETTINGS--
- local Name = LoadName()
- local ready = fs.exists("RobcOS_ticket")
- --END OF CONFIG--
- local mainpglines = {"Files", "Setup", "Misc", "Reboot", "Shutdown", "Check For Updates"}
- local funpglines = {"Game: Snake", "Utility: Chat System", "1.16+: Play Music", "Return"}
- function WriteHeader(PcName)
- term.clear()
- term.setCursorPos(5, 1)
- term.write("ROBCO INDUSTRIES UNIFIED OPERATING SYSTEM")
- term.setCursorPos(7, 2)
- term.write("COPYRIGHT 2075-2077 ROBCO INDUSTRIES")
- term.setCursorPos(20, 3)
- term.write(PcName)
- end
- function WriteMainPage()
- term.setCursorPos(5, 6)
- term.write(mainpglines[1])
- term.setCursorPos(5, 7)
- term.write(mainpglines[2])
- term.setCursorPos(5, 8)
- term.write(mainpglines[3])
- term.setCursorPos(5, 9)
- term.write(mainpglines[4])
- term.setCursorPos(5, 10)
- term.write(mainpglines[5])
- term.setCursorPos(5, 11)
- term.write(mainpglines[6])
- end
- function WriteFunPage()
- term.setCursorPos(5, 6)
- term.write(funpglines[1])
- term.setCursorPos(5, 7)
- term.write(funpglines[2])
- term.setCursorPos(5, 8)
- term.write(funpglines[3])
- term.setCursorPos(5, 9)
- term.write(funpglines[4])
- end
- function WriteSelectedLabel(x,y,table)
- local number = (y - 5)
- local page = table[number]
- term.setCursorPos(x, y)
- term.write(page)
- end
- function PlayMusic()
- term.setCursorPos(1, 1)
- term.setTextColor(colors.green)
- term.setBackgroundColor(colors.black)
- term.clear()
- term.write("Enter .dfpwm file URL")
- term.setCursorPos(1, 2)
- input = read()
- shell.run("speaker", "play", input)
- end
- function SelectorFun()
- local x, y = 5, 6
- local xSize, ySize = term.getSize()
- while true do
- -- Draw a white space at the current x/y co-ord:
- term.setBackgroundColor(colours.black)
- term.setTextColor(colours.green)
- term.clear()
- WriteHeader(Name)
- WriteFunPage()
- term.setCursorPos(x, y)
- term.setBackgroundColor(colours.green)
- term.setTextColor(colours.black)
- WriteSelectedLabel(5,y,funpglines)
- -- Wait for a key event:
- local event, key = os.pullEvent("key")
- -- Act on it:
- if key == keys.up and y > 6 then
- y = y - 1
- elseif key == keys.down and y < 12 then
- y = y + 1
- elseif key == keys.enter and y == 6 then
- shell.run("Rsnake")
- elseif key == keys.enter and y == 7 then
- shell.run("Rchat")
- elseif key == keys.enter and y == 8 then
- PlayMusic()
- elseif key == keys.enter and y == 9 then
- SelectorMain()
- break
- end
- end
- end
- function SelectorMain()
- local x, y = 5, 6
- local xSize, ySize = term.getSize()
- while true do
- -- Draw a white space at the current x/y co-ord:
- term.setBackgroundColor(colours.black)
- term.setTextColor(colours.green)
- term.clear()
- WriteHeader(Name)
- WriteMainPage()
- term.setCursorPos(x, y)
- term.setBackgroundColor(colours.green)
- term.setTextColor(colours.black)
- WriteSelectedLabel(5,y,mainpglines)
- -- Wait for a key event:
- local event, key = os.pullEvent("key")
- -- Act on it:
- if key == keys.up and y > 6 then
- y = y - 1
- elseif key == keys.down and y < 12 then
- y = y + 1
- elseif key == keys.enter and y == 7 then
- term.setBackgroundColor(colours.black)
- term.setTextColor(colours.green)
- shell.run("setup")
- elseif key == keys.enter and y == 6 then
- term.clear()
- shell.run("filebrowse")
- elseif key == keys.enter and y == 8 then
- SelectorFun()
- break
- elseif key == keys.enter and y == 9 then
- os.reboot()
- elseif key == keys.enter and y == 10 then
- os.shutdown()
- elseif key == keys.enter and y == 11 then
- term.setBackgroundColor(colours.black)
- term.setTextColor(colours.green)
- term.clear()
- term.setCursorPos(1, 1)
- shell.run("pastebin", "run", "gMC3n107")
- break
- end
- end
- end
- function OSmain()
- WriteHeader(Name)
- term.setCursorPos(5, 7)
- SelectorMain()
- end
- OSmain()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement