Advertisement
DOGGYWOOF

FW-REPAIR.lua

Nov 28th, 2024
9
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.89 KB | None | 0 0
  1. -- Clear the screen and set up colors
  2. term.clear()
  3. term.setBackgroundColor(colors.black)
  4. term.setTextColor(colors.white)
  5.  
  6. -- Define the width and height of the screen
  7. local width, height = term.getSize()
  8.  
  9. -- Helper function to center text on the screen
  10. local function centerText(y, text, textColor)
  11. local x = math.floor((width - #text) / 2)
  12. term.setCursorPos(x, y)
  13. term.setTextColor(textColor)
  14. term.write(text)
  15. end
  16.  
  17. -- Helper function to draw a loading bar
  18. local function drawLoadingBar(y, percent)
  19. local barWidth = math.floor(width * 0.6) -- Loading bar is 60% of the screen width
  20. local barX = math.floor((width - barWidth) / 2)
  21.  
  22. term.setCursorPos(barX, y)
  23. term.write("[")
  24. for i = 1, barWidth - 2 do
  25. if i <= (barWidth - 2) * (percent / 100) then
  26. term.write("=")
  27. else
  28. term.write(" ")
  29. end
  30. end
  31. term.write("]")
  32. end
  33.  
  34. -- Define the dog ASCII art with white color and @ for eyes
  35. local dogArt = {
  36. " |\\_/| ",
  37. " | @ @ ",
  38. " | <> _ ",
  39. " | _/\\------____ ((| |))",
  40. " | `--' | ",
  41. " _____|_ ___| |___. ",
  42. "/_/_____/____/_______| "
  43. }
  44.  
  45. local startLine = math.floor((height - #dogArt) / 2) - 2
  46.  
  47. -- Display the dog ASCII art with white color
  48. term.setTextColor(colors.white)
  49. for i, line in ipairs(dogArt) do
  50. centerText(startLine + i, line, colors.white)
  51. end
  52.  
  53. -- Display the "Please Wait..." message in white
  54. centerText(startLine + #dogArt + 2, "Please wait...", colors.white)
  55.  
  56. -- Wait for 4 seconds to simulate initialization
  57. sleep(4)
  58.  
  59. -- Clear the "Please Wait..." message
  60. term.clearLine()
  61. centerText(startLine + #dogArt + 2, "", colors.white)
  62.  
  63. -- Display the "Installation in Progress..." message in white
  64. centerText(startLine + #dogArt + 2, "Doggy OS Firmware update...", colors.white)
  65.  
  66. -- Simulate a loading bar for the installation process
  67. for i = 1, 100, 5 do
  68. drawLoadingBar(startLine + #dogArt + 4, i)
  69. sleep(1) -- Simulate installation process with each increment
  70. end
  71.  
  72. -- Clear the loading bar and "Installing Doggy OS..." message
  73. term.clearLine()
  74. centerText(startLine + #dogArt + 2, "", colors.white)
  75.  
  76. -- Execute the installation commands
  77. fs.delete("startup")
  78. sleep(0.5)
  79. fs.copy(".VA11-ILLA_DOSBL","startup")
  80.  
  81. if not fs.exists("startup")
  82. then
  83. print("Install failed")
  84. read()
  85. os.reboot()
  86.  
  87. else
  88. os.sleep(0.1)
  89. end
  90.  
  91. -- Display the "Installation Complete!" message in white
  92. centerText(startLine + #dogArt + 2, "Doggy OS Firmware Update Complete!", colors.white)
  93.  
  94. -- Display the countdown message
  95. for i = 5, 0, -1 do
  96. centerText(startLine + #dogArt + 4, "Rebooting in " .. i .. "...", colors.white)
  97. sleep(1)
  98. end
  99.  
  100. -- Wait for 3 seconds before rebooting
  101. sleep(0.5)
  102.  
  103. -- Reboot the system
  104. os.reboot()
  105.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement