Leon_Lejon

CC OS 2 INSTALL DISK ezinstallp2

Jun 16th, 2024 (edited)
610
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. shell.run("pastebin get bbBTPdx7 os/walktrough")
  2. local w,h = term.getSize()
  3.  
  4. --Center Text
  5.  
  6. function printCentered (y,s)
  7.     local x = math.floor((w - string.len(s)) /2)
  8.     term.setCursorPos(x,y)
  9.     term.clearLine()
  10.     term.write(s)
  11. end
  12.  
  13. --Drawmenu
  14.  
  15. local nOption = 1
  16.  
  17. local function drawMenu()
  18.     term.setBackgroundColor(colors.cyan)
  19.     term.clear()
  20.     term.setCursorPos(1,1)
  21.     local logo = paintutils.loadImage("os/.logo")
  22.     paintutils.drawImage(logo, 1, 1)
  23.     term.setBackgroundColor(colors.cyan)
  24.    
  25.     term.setCursorPos(w-11,1)
  26.     if nOption == 1 then
  27.         term.write("YES")
  28.     elseif nOption == 2 then
  29.         term.write("NO")
  30.     elseif nOption == 3 then
  31.         term.write("EXIT SETUP")
  32.     else
  33.         end
  34. end    
  35.  
  36. --GUI
  37.  
  38. term.clear()
  39. local function drawFrontend()
  40.     printCentered(math.floor(h/2) -3, "")
  41.     printCentered(math.floor(h/2) -2, "INSTALL USING FLOPPY DISK?")
  42.     printCentered(math.floor(h/2) -1, "")
  43.     printCentered(math.floor(h/2) + 0, (nOption == 1 and "[ YES ]") or "YES")
  44.     printCentered(math.floor(h/2) + 1, (nOption == 2 and "[ NO ]") or "NO")
  45.     printCentered(math.floor(h/2) + 2, (nOption == 3 and "[ EXIT SETUP ]") or "EXIT SETUP")
  46. end
  47.  
  48. --Display
  49.  
  50. drawMenu()
  51. drawFrontend()
  52.  
  53. while true do
  54.     local e,p = os.pullEvent()
  55.         if e == "key" then
  56.             local key = p
  57.             if key == keys.up or key == 200 then
  58.            
  59.                 if nOption > 1 then
  60.                     nOption = nOption -1
  61.                     drawMenu()
  62.                     drawFrontend()
  63.                 end
  64.             elseif key == keys.down or key == 208 then
  65.                 if nOption < 3 then
  66.                     nOption = nOption +1
  67.                     drawMenu()
  68.                     drawFrontend()
  69.                 end
  70.         elseif key == keys.enter then
  71.             break
  72. end
  73. end
  74. end
  75.  
  76. term.clear()
  77.  
  78. --Conditions
  79. if nOption == 1 then
  80.     shell.run("rm disk/*")
  81.     shell.run("pastebin get GQyFnaPu disk/installer")
  82.     shell.run("pastebin get pbLcNfKv disk/install")
  83.     shell.run("disk/install")
  84. elseif nOption == 2 then
  85.     shell.run("pastebin get GQyFnaPu os/install")
  86.     shell.run("pastebin get fAUEnic0 os/installer")
  87.     shell.run("os/installer")
  88. else
  89.     term.setBackgroundColor(colors.black)
  90.     term.clear()
  91.     term.setCursorPos(1,1)
  92. end
Advertisement
Add Comment
Please, Sign In to add comment