GochiPC

2.6U

Aug 21st, 2025
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 13.88 KB | None | 0 0
  1. -- WARNING DO NOT EDIT SCRIPT THIS EILL 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. -- MDE
  7. local mde = "mde.lua"
  8. if fs.exists(mde) then
  9.     shell.run("mde.lua")
  10. end
  11.  
  12. -- Color Saveing
  13. if fs.exists("bsave.txt") then
  14.   if not term.isColor() then
  15.    term.setBackgroundColor(colors.black)
  16.   else
  17.    local f = fs.open("bsave.txt", "r")
  18.    local savedColor = f.readAll()
  19.    f.close()
  20.    if savedColor == "green" then
  21.      term.setBackgroundColor(colors.green)
  22.    elseif savedColor == "blue" then
  23.      term.setBackgroundColor(colors.blue)
  24.    elseif savedColor == "black" then
  25.      term.setBackgroundColor(colors.black)
  26.    elseif savedColor == "gray" then
  27.      term.setBackgroundColor(colors.gray)
  28.    end
  29.   end
  30.   term.clear()
  31. end
  32.  
  33. -- items
  34. wel = "Welcome Player!"
  35. local passFile = "password.txt"
  36.  
  37. -- Monitor
  38. local monitor = peripheral.find("monitor")
  39. if monitor then
  40.     monitor.setBackgroundColor(colors.black)
  41.     monitor.clear()
  42.     monitor.setCursorPos(1,1)
  43.     monitor.write("MineOS2 Signal")
  44. end
  45.  
  46. -- MineOS
  47. local running = true
  48.  
  49. -- start at first
  50. os.setComputerLabel("2.6")
  51. term.setCursorPos(1,1)
  52. term.clear()
  53. term.setTextColor(colors.yellow)
  54. local stored = readPassword()
  55. if stored then
  56.     print("Enter password")
  57.     term.setTextColor(colors.white)
  58.     local entered = read("*")
  59.     if entered ~= stored then
  60.         print("Access denied")
  61.     end
  62. end
  63. term.setTextColor(colors.yellow)
  64. if fs.exists("nsave.txt") then
  65.       local file = fs.open("nsave.txt", "r")
  66.       local saved = file.readAll()
  67.       file.close()
  68.       print("Welcome " .. saved .. "!")
  69. else
  70.       print(wel)
  71. end
  72.  
  73. local speaker = peripheral.find("speaker")
  74. if speaker then
  75.   speaker.playNote("pling", 1.0, 12)
  76.   sleep(0.4)
  77.   speaker.playNote("pling", 1.0, 10)
  78. end
  79. sleep(3)
  80. term.clear()
  81. term.setCursorPos(1,1)
  82. print("MineOS2")
  83.  
  84. -- prompt
  85. while running do
  86.    
  87.     -- detector
  88.     term.setTextColor(colors.yellow)
  89.     io.write("> ")
  90.     term.setTextColor(colors.white)
  91.     local input = read()
  92.     local args = {}
  93.     for word in string.gmatch(input, "[^%s]+") do
  94.         table.insert(args, word)
  95.     end
  96.  
  97.     local command = args[1]
  98.  
  99. -- commands
  100.  
  101.     if command == "about" then
  102.         print("   _______    MineOS")
  103.         print("  |   |   |   Version: 2.6")
  104.         print("  | S | e |   Kernel: DEV2")
  105.         print("  | O | n |   CCID: " .. os.getComputerID())
  106.         print("  |   | i |   Uptime: " .. math.floor(os.clock()) .. "s")
  107.         print("  | > | M |   CR: 2023 - 2025")
  108.         if term.isColor() then
  109.             print("              Color: true")
  110.         else
  111.             print("              Color: false")
  112.         end
  113.        
  114.     elseif command == "help" then
  115.         term.setTextColor(colors.orange)
  116.         print("Help")
  117.         term.setTextColor(colors.white)
  118.         print("tipe 'plist' or 'mlist'")
  119.        
  120.         elseif command == "plist" then
  121.         local dir = shell.dir()
  122.         local files = fs.list(dir)
  123.         for i, file in ipairs(files) do
  124.             local fullPath = fs.combine(dir, file)
  125.             local isStartupInRoot = (dir == "/" or dir == "") and file == "startup.lua"
  126.             local isHidden = file:match("^%.")
  127.             local isRom = file == "rom"
  128.             if not isRom and not isStartupInRoot and not isHidden then
  129.                 if fs.isDir(fullPath) then
  130.                     print("FO " .. file)
  131.                 else
  132.                     print("FI " .. file)
  133.                 end
  134.             end
  135.         end
  136.        
  137.     elseif command == "hello" then
  138.         term.clear()
  139.         term.setCursorPos(1,1)
  140.         term.setTextColor(colors.orange)
  141.         textutils.slowPrint("Hello World!")
  142.         sleep(3)
  143.         term.clear()
  144.         term.setCursorPos(1,1)
  145.        
  146.     elseif command == "pedit" then
  147.      local filename = args[2]
  148.      if filename then
  149.       local lower = string.lower(filename)
  150.       if lower == "startup" or lower == "startup.lua" then
  151.        print("Warning you about to edit OS File")
  152.        sleep(2)
  153.        local prevBG = term.getBackgroundColor()
  154.        shell.run("edit", "startup.lua")
  155.        term.setBackgroundColor(prevBG)
  156.        term.clear()
  157.        term.setCursorPos(1, 1)
  158.       elseif fs.isDir(filename) then
  159.        print("Cannot edit folder")
  160.       else
  161.          local ok, err = pcall(function()
  162.          local prevBG = term.getBackgroundColor()
  163.          shell.run("edit", filename)
  164.          term.setBackgroundColor(prevBG)
  165.          term.clear()
  166.          term.setCursorPos(1, 1)
  167.       end)
  168.       if not term.isColor() then
  169.       term.clear()
  170.       term.setCursorPos(1,1)
  171.       else
  172.        if not ok then print("Edit failed "..tostring(err)) end
  173.        if ok and fs.exists("bsave.txt") then
  174.         local f = fs.open("bsave.txt", "r")
  175.         local saved = f.readAll()
  176.         f.close()
  177.         if colors[saved] then
  178.          term.setBackgroundColor(colors[saved])
  179.          term.clear()
  180.          term.setCursorPos(1, 1)
  181.         end
  182.        end
  183.       end
  184.      end
  185.     end
  186.        
  187.     elseif command == "popen" then
  188.         local progName = args[2]
  189.         if progName then
  190.             local lower = string.lower(progName)
  191.             if lower == "startup" or lower == "startup.lua" then
  192.                 print("Error opening that file")
  193.             elseif shell.resolveProgram(progName) then
  194.                 print("Running " .. progName)
  195.                 shell.run(progName)
  196.             else
  197.                 print("Unknown Program to open")
  198.             end
  199.         end
  200.    
  201.     elseif command == "mlist" then
  202.       local lines = {
  203.         "",
  204.         "hello",
  205.         "about",
  206.         "shutoff",
  207.         "popen <1>",
  208.         "pedit <1>",
  209.         "reboot",
  210.         "cls",
  211.         "shell",
  212.         "cal <math>",
  213.         "plist",
  214.         "mlist",
  215.         "pdelete <1>",
  216.         "pir <ins/run>",
  217.         "prename <1> <2>",
  218.         "cd <1>",
  219.         "mfolder <1>",
  220.         "tcolor <help>",
  221.         "cname <1>",
  222.         "monitor <help> ",
  223.         "time",
  224.         "say <1>",
  225.         "desktop"
  226.       }
  227.  
  228.       local w, h = term.getSize()
  229.       local line = 0
  230.       line = 2
  231.       for i = 2, #lines do
  232.         print(lines[i])
  233.         line = line + 1
  234.         if line >= h then
  235.             print("Press any key to continue...")
  236.             os.pullEvent("key")
  237.             term.clear()
  238.             term.setCursorPos(1,1)
  239.             line = 2
  240.         end
  241.       end
  242.        
  243.     elseif command == "shutoff" then
  244.         term.clear()
  245.         term.setCursorPos(1,1)
  246.         print("Please Wait...")
  247.         sleep(1)
  248.         term.setCursorPos(1,1)
  249.         term.setTextColor(colors.red)
  250.         print("ShuttingOFF...")
  251.         sleep(4)
  252.         running = false
  253.         os.shutdown()
  254.    
  255.     elseif command == "reboot" then
  256.         term.clear()
  257.         term.setCursorPos(1,1)
  258.         print("Please Wait...")
  259.         sleep(1)
  260.         term.clear()
  261.         term.setCursorPos(1,1)
  262.         term.setTextColor(colors.red)
  263.         print("Rebooting...")
  264.         sleep(4)
  265.         running = false
  266.         os.reboot()
  267.    
  268.     elseif command == "cls" then
  269.         term.clear()
  270.         term.setCursorPos(1,1)
  271.    
  272.     elseif command == "shell" then
  273.         term.setTextColor(colors.yellow)
  274.         print("MineOS2")
  275.        
  276.     elseif command == "cal" then
  277.         local expression = input:sub(5) -- everything after 'cal '
  278.         local fn, err = load("return " .. expression)
  279.         if fn then
  280.             local ok, result = pcall(fn)
  281.             if ok then
  282.                 print(result)
  283.             else
  284.                 print("Error")
  285.             end
  286.         end
  287.        
  288.     elseif command == "pdelete" then
  289.       local filename = args[2]
  290.  
  291.       if filename then
  292.         filename = filename
  293.         local currentDir = shell.dir()
  294.         local fullPath = fs.combine(currentDir, filename)
  295.         local lower = string.lower(filename)
  296.         if currentDir == "" and (lower == "startup.lua" or lower == "startup") then
  297.             print("Error deleting that file")
  298.         elseif fs.exists(fullPath) then
  299.             fs.delete(fullPath)
  300.             print("Deleted " .. filename)
  301.         else
  302.             print("File not found " .. filename)
  303.         end
  304.       end
  305.        
  306.     elseif command == "pir" then
  307.       local sub = args[2]
  308.       local code = args[3]
  309.  
  310.       if sub == "run" and code then
  311.         shell.run("pastebin", "run", code)
  312.  
  313.       elseif sub == "ins" and code then
  314.         local saveAs = "pir_" .. code
  315.         shell.run("pastebin", "get", code, saveAs)
  316.         print("Installed as " .. saveAs)
  317.       end
  318.        
  319.     elseif command == "prename" then
  320.       local oldName = args[2]
  321.       local newName = args[3]
  322.  
  323.       if not oldName or not newName then
  324.       else
  325.         oldName = oldName .. ".lua"
  326.         newName = newName .. ".lua"
  327.         local currentDir = shell.dir()
  328.         local fullOldPath = fs.combine(currentDir, oldName)
  329.         local fullNewPath = fs.combine(currentDir, newName)
  330.         if currentDir == "" and (oldName == "startup.lua" or newName == "startup.lua") then
  331.             print("Error renaming that file")
  332.         elseif not fs.exists(fullOldPath) then
  333.             print("Not exist" .. oldName)
  334.         elseif fs.exists(fullNewPath) then
  335.             print("Already exists " .. newName)
  336.         else
  337.             fs.move(fullOldPath, fullNewPath)
  338.             print("Renamed " .. newName)
  339.         end
  340.       end
  341.        
  342.     elseif command == "cd" then
  343.         local target = args[2]
  344.         if target and fs.exists(target) and fs.isDir(target) then
  345.             shell.setDir(target)
  346.             print("Changed Dir " .. shell.dir())
  347.         else
  348.             print("Dir not found")
  349.         end
  350.        
  351.     elseif command == "mfolder" then
  352.           local folderName = args[2]
  353.           if folderName then
  354.             local currentDir = shell.dir()
  355.             local fullPath = fs.combine(currentDir, folderName)
  356.             if fs.exists(fullPath) then
  357.               print("Folder exist")
  358.             else
  359.               fs.makeDir(fullPath)
  360.               print("Created " .. folderName)
  361.             end
  362.           end
  363.        
  364.    elseif command == "tcolor" then
  365.     if not term.isColor() then
  366.      print("This computer cant work with colors")
  367.     else
  368.      local colorname = args[2]
  369.      if colorname == "green" then
  370.      term.setBackgroundColor(colors.green)
  371.      term.clear()
  372.      term.setCursorPos(1,1)
  373.      local f = fs.open("bsave.txt", "w")
  374.      f.write("green")
  375.      f.close()
  376.      elseif colorname == "blue" then
  377.      term.setBackgroundColor(colors.blue)
  378.      term.clear()
  379.      term.setCursorPos(1,1)
  380.      local f = fs.open("bsave.txt", "w")
  381.      f.write("blue")
  382.      f.close()
  383.      elseif colorname == "black" then
  384.      term.setBackgroundColor(colors.black)
  385.      term.clear()
  386.      term.setCursorPos(1,1)
  387.      local f = fs.open("bsave.txt", "w")
  388.      f.write("black")
  389.      f.close()
  390.      elseif colorname == "gray" then
  391.      term.setBackgroundColor(colors.gray)
  392.      term.clear()
  393.      term.setCursorPos(1,1)
  394.      local f = fs.open("bsave.txt", "w")
  395.      f.write("gray")
  396.      f.close()
  397.      elseif colorname == "help" then
  398.       print("Colors only that you can change")
  399.       print("Blue/Gray/Black/Green")
  400.      else
  401.      print("Invalid color.")
  402.      end
  403.     end
  404.        
  405.    elseif command == "cname" then
  406.     if args[2] then
  407.       local file = fs.open("nsave.txt", "w")
  408.       file.write(args[2])
  409.       file.close()
  410.       print("Name saved: " .. args[2])
  411.     end
  412.        
  413.    elseif command == "say" then
  414.     local message = input:match("^%S+%s+(.+)")
  415.     if message then
  416.       print(message)
  417.     end
  418.    elseif command == "time" then
  419.        local current = os.date("%I:%M %p")
  420.        print("time: " .. current)
  421.    
  422.    elseif command == "desktop" then
  423.         term.setBackgroundColor(colors.black)
  424.         shell.run("mde")
  425.        
  426.    elseif command == "monitor" then
  427.     if not monitor then
  428.         print("monitor didint detected")
  429.     end
  430.  
  431.     if monitor then
  432.         local moch = args[2]
  433.         local coch = args[3]
  434.  
  435.         if moch == "clear" then
  436.             monitor.clear()
  437.  
  438.         elseif moch == "help" then
  439.             print("color")
  440.             print("clear")
  441.             print("help")
  442.             print("say <1>")
  443.  
  444.         elseif moch == "color" then
  445.             if not monitor.isColor() then
  446.                 print("Monitor not support colors")
  447.             else
  448.                 if coch == "blue" then
  449.                     monitor.setBackgroundColor(colors.blue)
  450.                     monitor.clear()
  451.                     print("changed color blue")
  452.                 elseif coch == "gray" then
  453.                     monitor.setBackgroundColor(colors.gray)
  454.                     monitor.clear()
  455.                     print("changed color gray")
  456.                 elseif coch == "black" then
  457.                     monitor.setBackgroundColor(colors.black)
  458.                     monitor.clear()
  459.                     print("changed color black")
  460.                 elseif coch == "green" then
  461.                     monitor.setBackgroundColor(colors.green)
  462.                     monitor.clear()
  463.                     print("changed color green")
  464.                 elseif coch == "help" then
  465.                     print("colors that you can change")
  466.                     print("blue/gray/black/green")
  467.                 else
  468.                     print("Unknown color")
  469.                 end
  470.             end
  471.  
  472.         elseif moch == "say" then
  473.             local messageParts = {}
  474.             for i = 3, #args do
  475.                 table.insert(messageParts, args[i])
  476.             end
  477.             local message = table.concat(messageParts, " ")
  478.  
  479.             monitor.setCursorPos(1, 1)
  480.             monitor.clear()
  481.             monitor.write(message)
  482.         end
  483.     end
  484.    else
  485.         print("Unknown MProgram to open")
  486.    end
  487. end
  488.  
Advertisement
Add Comment
Please, Sign In to add comment