Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Windows 10 BSOD Simulation for ComputerCraft
- local function drawBSOD()
- -- Clear the screen with a blue background
- term.setBackgroundColor(colors.blue)
- term.clear()
- -- Set the text color to white
- term.setTextColor(colors.white)
- -- Set the cursor position and write the BSOD text
- term.setCursorPos(1, 2)
- print(":( Your PC ran into a problem and needs to restart.")
- term.setCursorPos(1, 4)
- print("We're just collecting some error info, and then we'll restart for you.")
- term.setCursorPos(1, 6)
- print("If you'd like to know more, you can search online later for this error:")
- term.setCursorPos(1, 8)
- print("INACCESSIBLE_BOOT_DEVICE")
- end
- local function simulateProgress()
- local progress = 0
- while progress < 100 do
- term.setCursorPos(1, 10)
- print(progress .. "% complete")
- -- Sleep for a short duration to simulate progress time
- sleep(0.5)
- -- Increase the progress by a random amount (10, 4, or 6)
- local increment = math.random(1, 3)
- if increment == 1 then
- progress = progress + 10
- elseif increment == 2 then
- progress = progress + 4
- else
- progress = progress + 6
- end
- -- Ensure progress does not exceed 100%
- if progress > 100 then
- progress = 100
- end
- end
- -- Display 100% complete
- term.setCursorPos(1, 10)
- print("100% complete")
- end
- local function main()
- -- Draw the BSOD screen
- drawBSOD()
- -- Simulate the progress percentage
- simulateProgress()
- -- Wait for 1 second before rebooting
- sleep(1)
- -- Reboot the computer
- os.reboot()
- end
- -- Run the main function
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement