Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- WARNING DO NOT EDIT SCRIPT THIS WILL BUG OS
- -- if you are best at script why you give it an try
- -- to see make an os but if you are an noob
- -- dont edit
- -- MineOS
- local running = true
- -- start at first
- os.setComputerLabel("2.0")
- term.setCursorPos(1,1)
- term.clear()
- term.setTextColor(colors.yellow)
- print("Welcome Player!")
- sleep(3)
- term.clear()
- term.setCursorPos(1,1)
- print("MineOS2")
- -- prompt
- while running do
- term.setTextColor(colors.yellow)
- io.write("> ")
- term.setTextColor(colors.white)
- local input = read()
- local args = {}
- for word in string.gmatch(input, "[^%s]+") do
- table.insert(args, word)
- end
- local command = args[1]
- -- commands
- if command == "about" then
- term.setTextColor(colors.orange)
- print("About")
- term.setTextColor(colors.white)
- print(" _______ MineOS")
- print(" | | | Version: 2.0")
- print(" | S | e | Kernel: DEV2")
- print(" | O | n | CCID: " .. os.getComputerID())
- print(" | | i | Uptime: " .. math.floor(os.clock()) .. "s")
- print(" | > | M | CR: 2023 - 2025")
- if term.isColor() then
- print(" Color: true")
- else
- print(" Color: false")
- end
- elseif command == "help" then
- term.setTextColor(colors.orange)
- print("Help")
- term.setTextColor(colors.white)
- print("tipe 'plist' or 'mlist'")
- elseif command == "plist" then
- term.setTextColor(colors.orange)
- print("Programs")
- term.setTextColor(colors.white)
- local files = fs.list("/")
- for _, file in ipairs(files) do
- local isStartup = string.match(file, "^startup$") or string.match(file, "^startup%..+")
- if not isStartup and file ~= "rom" then
- print(file)
- end
- end
- elseif command == "hello" then
- term.clear()
- term.setCursorPos(1,1)
- term.setTextColor(colors.orange)
- textutils.slowPrint("Hello World!")
- sleep(3)
- term.clear()
- term.setCursorPos(1,1)
- elseif command == "pedit" then
- local filename = args[2]
- if filename then
- local lower = string.lower(filename)
- if lower == "startup" or lower == "startup.lua" then
- print("warning this is startup file that stores everything")
- sleep(3)
- shell.run("edit startup.lua")
- else
- shell.run("edit", filename)
- end
- end
- elseif command == "popen" then
- local progName = args[2]
- if progName then
- local lower = string.lower(progName)
- if lower == "startup" or lower == "startup.lua" then
- print("Error opening that file")
- elseif shell.resolveProgram(progName) then
- print("Running " .. progName)
- shell.run(progName)
- else
- print("Unknown Program to open")
- end
- end
- elseif command == "mlist" then
- term.setTextColor(colors.orange)
- print("MPrograms")
- term.setTextColor(colors.white)
- print("hello -- hello world")
- print("about -- about system")
- print("shutoff -- shutdowns")
- print("popen <program> -- opens program")
- print("pedit <program> -- edits program")
- print("reboot -- restarts")
- print("cls -- clears screen")
- print("shell -- shows text start")
- print("cal <math> -- calculator")
- print("plist -- lists programs ")
- print("mlist -- lists mineos programs")
- print("pdelete <program> -- deletes program")
- print("pir <ins/run> -- installs program")
- elseif command == "shutoff" then
- term.clear()
- term.setCursorPos(1,1)
- print("Please Wait...")
- sleep(1)
- term.setCursorPos(1,1)
- term.setTextColor(colors.red)
- print("ShuttingOFF...")
- sleep(4)
- running = false
- os.shutdown()
- elseif command == "reboot" then
- term.clear()
- term.setCursorPos(1,1)
- print("Please Wait...")
- sleep(1)
- term.clear()
- term.setCursorPos(1,1)
- term.setTextColor(colors.red)
- print("Rebooting...")
- sleep(4)
- running = false
- os.reboot()
- elseif command == "cls" then
- term.clear()
- term.setCursorPos(1,1)
- elseif command == "shell" then
- term.setTextColor(colors.yellow)
- print("MineOS2")
- elseif command == "cal" then
- local expression = input:sub(5) -- everything after 'cal '
- local fn, err = load("return " .. expression)
- if fn then
- local ok, result = pcall(fn)
- if ok then
- print(result)
- else
- print("Error")
- end
- end
- elseif command == "pdelete" then
- local filename = args[2]
- if filename then
- local lower = string.lower(filename)
- if lower == "startup" or lower == "startup.lua" then
- print("Error deleting that file")
- elseif fs.exists(filename) then
- fs.delete(filename)
- print("Deleted " .. filename)
- else
- print("Unknown Program to delete")
- end
- end
- elseif command == "pir" then
- local action = args[2]
- local code = args[3]
- if action == "ins" and code then
- local url = "https://pastebin.com/raw/" .. code
- local response = http.get(url)
- if response then
- local content = response.readAll()
- response.close()
- local filename = "pir_" .. code .. ".lua"
- if fs.exists(filename) then
- print("File already exists " .. filename)
- else
- local file = fs.open(filename, "w")
- file.write(content)
- file.close()
- print("Installed as " .. filename)
- end
- else
- print("Failed to fetch")
- end
- elseif action == "run" and code then
- local url = "https://pastebin.com/raw/" .. code
- local response = http.get(url)
- if response then
- local content = response.readAll()
- response.close()
- local fn, err = load(content, "pir_" .. code)
- if fn then
- print("Running code")
- local ok, msg = pcall(fn)
- if not ok then
- print("Error running code script = " .. msg)
- end
- end
- else
- print("Error code " .. (err or "Unknown error"))
- end
- else
- print("Failed to fetch")
- end
- else
- print("Unknown MProgram to open")
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment