Advertisement
DOGGYWOOF

Untitled

Jun 27th, 2024 (edited)
6
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.78 KB | None | 0 0
  1. -- Windows 10 BSOD Simulation for ComputerCraft
  2.  
  3. local function drawBSOD()
  4. -- Clear the screen with a blue background
  5. term.setBackgroundColor(colors.blue)
  6. term.clear()
  7.  
  8. -- Set the text color to white
  9. term.setTextColor(colors.white)
  10.  
  11. -- Set the cursor position and write the BSOD text
  12. term.setCursorPos(1, 2)
  13. print(":( Your PC ran into a problem and needs to restart.")
  14.  
  15. term.setCursorPos(1, 4)
  16. print("We're just collecting some error info, and then we'll restart for you.")
  17.  
  18. term.setCursorPos(1, 6)
  19. print("If you'd like to know more, you can search online later for this error:")
  20.  
  21. term.setCursorPos(1, 8)
  22. print("INACCESSIBLE_BOOT_DEVICE")
  23. end
  24.  
  25. local function simulateProgress()
  26. local progress = 0
  27. while progress < 100 do
  28. term.setCursorPos(1, 10)
  29. print(progress .. "% complete")
  30.  
  31. -- Sleep for a short duration to simulate progress time
  32. sleep(0.5)
  33.  
  34. -- Increase the progress by a random amount (10, 4, or 6)
  35. local increment = math.random(1, 3)
  36. if increment == 1 then
  37. progress = progress + 10
  38. elseif increment == 2 then
  39. progress = progress + 4
  40. else
  41. progress = progress + 6
  42. end
  43.  
  44. -- Ensure progress does not exceed 100%
  45. if progress > 100 then
  46. progress = 100
  47. end
  48. end
  49.  
  50. -- Display 100% complete
  51. term.setCursorPos(1, 10)
  52. print("100% complete")
  53. end
  54.  
  55. local function main()
  56. -- Draw the BSOD screen
  57. drawBSOD()
  58.  
  59. -- Simulate the progress percentage
  60. simulateProgress()
  61.  
  62. -- Wait for 1 second before rebooting
  63. sleep(1)
  64.  
  65. -- Reboot the computer
  66. os.reboot()
  67. end
  68.  
  69. -- Run the main function
  70. main()
  71.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement