Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local term = peripheral.wrap("monitor_1") -- Replace "monitor_1" with your monitor's label
- local width = 40 -- Adjust the width of the box as needed
- local height = 5 -- Adjust the height of the box as needed
- -- Function to center text on the screen
- local function centerText(y, text)
- local x = math.floor((term.getSize() - string.len(text)) / 2) + 1
- term.setCursorPos(x, y)
- term.write(text)
- end
- -- Function to display the fatal system error message with a fancy box
- local function displayError()
- term.clear()
- local startX = math.floor((term.getSize() - width) / 2) + 1
- local startY = math.floor((term.getSizeY() - height) / 2) + 1
- -- Draw the box
- for i = 0, width do
- for j = 0, height do
- term.setCursorPos(startX + i, startY + j)
- if i == 0 or i == width or j == 0 or j == height then
- term.write("*")
- else
- term.write(" ")
- end
- end
- end
- centerText(startY + math.floor(height / 2), "Fatal system error:")
- centerText(startY + math.floor(height / 2) + 1, "Missing system files")
- end
- -- Function to display a blinking cursor
- local function blinkCursor(x, y)
- while true do
- term.setCursorBlink(true)
- sleep(0.5)
- term.setCursorBlink(false)
- sleep(0.5)
- end
- end
- -- Function to reboot the system
- local function rebootSystem()
- term.clear()
- term.setCursorPos(1, 1)
- term.write("Rebooting system...")
- os.reboot()
- end
- -- Main program
- term.clear()
- parallel.waitForAny(displayError, blinkCursor)
- while true do
- local event, key = os.pullEvent("key")
- if event == "key" and key == 28 then -- Enter key
- rebootSystem()
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement