GochiPC

2.0

Jul 19th, 2025 (edited)
281
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 7.34 KB | None | 0 0
  1. -- WARNING DO NOT EDIT SCRIPT THIS WILL BUG OS
  2. -- if you are best at script why you give it an try
  3. -- to see make an os but if you are an noob
  4. -- dont edit
  5.  
  6. -- MineOS
  7. local running = true
  8.  
  9. -- start at first
  10. os.setComputerLabel("2.0")
  11. term.setCursorPos(1,1)
  12. term.clear()
  13. term.setTextColor(colors.yellow)
  14. print("Welcome Player!")
  15. sleep(3)
  16. term.clear()
  17. term.setCursorPos(1,1)
  18. print("MineOS2")
  19.  
  20. -- prompt
  21. while running do
  22.     term.setTextColor(colors.yellow)
  23.     io.write("> ")
  24.     term.setTextColor(colors.white)
  25.     local input = read()
  26.     local args = {}
  27.     for word in string.gmatch(input, "[^%s]+") do
  28.         table.insert(args, word)
  29.     end
  30.  
  31.     local command = args[1]
  32.  
  33. -- commands
  34.  
  35.     if command == "about" then
  36.         term.setTextColor(colors.orange)
  37.         print("About")
  38.         term.setTextColor(colors.white)
  39.         print("   _______    MineOS")
  40.         print("  |   |   |   Version: 2.0")
  41.         print("  | S | e |   Kernel: DEV2")
  42.         print("  | O | n |   CCID: " .. os.getComputerID())
  43.         print("  |   | i |   Uptime: " .. math.floor(os.clock()) .. "s")
  44.         print("  | > | M |   CR: 2023 - 2025")
  45.         if term.isColor() then
  46.             print("              Color: true")
  47.         else
  48.             print("              Color: false")
  49.         end
  50.     elseif command == "help" then
  51.         term.setTextColor(colors.orange)
  52.         print("Help")
  53.         term.setTextColor(colors.white)
  54.         print("tipe 'plist' or 'mlist'")
  55.        
  56.     elseif command == "plist" then
  57.         term.setTextColor(colors.orange)
  58.         print("Programs")
  59.         term.setTextColor(colors.white)
  60.         local files = fs.list("/")
  61.         for _, file in ipairs(files) do
  62.             local isStartup = string.match(file, "^startup$") or string.match(file, "^startup%..+")
  63.             if not isStartup and file ~= "rom" then
  64.             print(file)
  65.             end
  66.         end
  67.        
  68.     elseif command == "hello" then
  69.         term.clear()
  70.         term.setCursorPos(1,1)
  71.         term.setTextColor(colors.orange)
  72.         textutils.slowPrint("Hello World!")
  73.         sleep(3)
  74.         term.clear()
  75.         term.setCursorPos(1,1)
  76.        
  77.     elseif command == "pedit" then
  78.         local filename = args[2]
  79.         if filename then
  80.             local lower = string.lower(filename)
  81.             if lower == "startup" or lower == "startup.lua" then
  82.                 print("warning this is startup file that stores everything")
  83.                 sleep(3)
  84.                 shell.run("edit startup.lua")
  85.             else
  86.                 shell.run("edit", filename)
  87.             end
  88.         end
  89.        
  90.     elseif command == "popen" then
  91.         local progName = args[2]
  92.         if progName then
  93.             local lower = string.lower(progName)
  94.             if lower == "startup" or lower == "startup.lua" then
  95.                 print("Error opening that file")
  96.             elseif shell.resolveProgram(progName) then
  97.                 print("Running " .. progName)
  98.                 shell.run(progName)
  99.             else
  100.                 print("Unknown Program to open")
  101.             end
  102.         end
  103.    
  104.     elseif command == "mlist" then
  105.         term.setTextColor(colors.orange)
  106.         print("MPrograms")
  107.         term.setTextColor(colors.white)
  108.         print("hello  -- hello world")
  109.         print("about  -- about system")
  110.         print("shutoff  -- shutdowns")
  111.         print("popen <program>  -- opens program")
  112.         print("pedit <program> -- edits program")
  113.         print("reboot -- restarts")
  114.         print("cls -- clears screen")
  115.         print("shell -- shows text start")
  116.         print("cal <math> -- calculator")
  117.         print("plist -- lists programs ")
  118.         print("mlist -- lists mineos programs")
  119.         print("pdelete <program> -- deletes program")
  120.         print("pir <ins/run> -- installs program")
  121.        
  122.     elseif command == "shutoff" then
  123.         term.clear()
  124.         term.setCursorPos(1,1)
  125.         print("Please Wait...")
  126.         sleep(1)
  127.         term.setCursorPos(1,1)
  128.         term.setTextColor(colors.red)
  129.         print("ShuttingOFF...")
  130.         sleep(4)
  131.         running = false
  132.         os.shutdown()
  133.    
  134.     elseif command == "reboot" then
  135.         term.clear()
  136.         term.setCursorPos(1,1)
  137.         print("Please Wait...")
  138.         sleep(1)
  139.         term.clear()
  140.         term.setCursorPos(1,1)
  141.         term.setTextColor(colors.red)
  142.         print("Rebooting...")
  143.         sleep(4)
  144.         running = false
  145.         os.reboot()
  146.    
  147.     elseif command == "cls" then
  148.         term.clear()
  149.         term.setCursorPos(1,1)
  150.    
  151.     elseif command == "shell" then
  152.         term.setTextColor(colors.yellow)
  153.         print("MineOS2")
  154.        
  155.     elseif command == "cal" then
  156.         local expression = input:sub(5) -- everything after 'cal '
  157.         local fn, err = load("return " .. expression)
  158.         if fn then
  159.             local ok, result = pcall(fn)
  160.             if ok then
  161.                 print(result)
  162.             else
  163.                 print("Error")
  164.             end
  165.         end
  166.        
  167.     elseif command == "pdelete" then
  168.         local filename = args[2]
  169.         if filename then
  170.             local lower = string.lower(filename)
  171.             if lower == "startup" or lower == "startup.lua" then
  172.                 print("Error deleting that file")
  173.             elseif fs.exists(filename) then
  174.                 fs.delete(filename)
  175.                 print("Deleted " .. filename)
  176.             else
  177.                 print("Unknown Program to delete")
  178.             end
  179.         end
  180.        
  181.     elseif command == "pir" then
  182.             local action = args[2]
  183.             local code = args[3]
  184.  
  185.             if action == "ins" and code then
  186.                 local url = "https://pastebin.com/raw/" .. code
  187.                 local response = http.get(url)
  188.  
  189.                 if response then
  190.                     local content = response.readAll()
  191.                     response.close()
  192.                     local filename = "pir_" .. code .. ".lua"
  193.  
  194.                     if fs.exists(filename) then
  195.                         print("File already exists " .. filename)
  196.                     else
  197.                         local file = fs.open(filename, "w")
  198.                         file.write(content)
  199.                         file.close()
  200.                         print("Installed as " .. filename)
  201.                     end
  202.                 else
  203.                     print("Failed to fetch")
  204.                 end
  205.  
  206.             elseif action == "run" and code then
  207.                 local url = "https://pastebin.com/raw/" .. code
  208.                 local response = http.get(url)
  209.  
  210.                 if response then
  211.                     local content = response.readAll()
  212.                     response.close()
  213.                     local fn, err = load(content, "pir_" .. code)
  214.                     if fn then
  215.                          print("Running code")
  216.                          local ok, msg = pcall(fn)
  217.                          if not ok then
  218.                             print("Error running code script = " .. msg)
  219.                          end
  220.                     end
  221.                 else
  222.                     print("Error code " .. (err or "Unknown error"))
  223.                 end
  224.             else
  225.                print("Failed to fetch")
  226.             end
  227.  
  228.     else
  229.         print("Unknown MProgram to open")
  230.     end
  231. end
  232.  
Advertisement
Add Comment
Please, Sign In to add comment