Advertisement
DOGGYWOOF

Modified boot menu (quickmuffin's code)

Jan 27th, 2024 (edited)
5
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.00 KB | None | 0 0
  1. --[[> Copyright XenusSoft 2020 <]]--
  2. --[[> Use of file is allowed. <]]--
  3.  
  4. local isRunning = true
  5.  
  6. local function runRecovery()
  7. shell.run("/disk/bootloader/recovery")
  8. isRunning = false
  9. end
  10.  
  11. parallel.waitForAny(
  12. function()
  13. --< code here >--
  14. sleep(8) -- remove this, just for show
  15. end,
  16. function()
  17. local title = "Booting CraftOS..." -- Change title to what you prefer for the bootup.
  18. local w, h = term.getSize()
  19. local wm, hm = w / 2, h / 2
  20.  
  21. term.setBackgroundColor(colors.white)
  22. term.setTextColor(colors.black)
  23. term.clear()
  24. term.setCursorPos(wm - (#title / 2), hm)
  25. term.write(title)
  26. sleep(1)
  27.  
  28. while isRunning do
  29. for i = 1, 2 do
  30. term.setBackgroundColor(colors.black)
  31. term.setTextColor(colors.lightGray)
  32. term.clear()
  33. term.setCursorPos(wm - (#title / 2), hm)
  34. term.write(title)
  35. sleep(0.025)
  36.  
  37. term.setBackgroundColor(colors.black)
  38. term.setTextColor(colors.gray)
  39. term.clear()
  40. term.setCursorPos(wm - (#title / 2), hm)
  41. term.write(title)
  42. sleep(0.025)
  43.  
  44. term.setBackgroundColor(colors.black)
  45. term.setTextColor(colors.lightGray)
  46. term.clear()
  47. term.setCursorPos(wm - (#title / 2), hm)
  48. term.write(title)
  49. sleep(0.025)
  50.  
  51. term.setBackgroundColor(colors.black)
  52. term.setTextColor(colors.white)
  53. term.clear()
  54. term.setCursorPos(wm - (#title / 2), hm)
  55. term.write(title)
  56. sleep(0.025)
  57. end
  58.  
  59. term.setBackgroundColor(colors.black)
  60. term.setTextColor(colors.white)
  61. term.clear()
  62. term.setCursorPos(wm - (#title / 2), hm)
  63. term.write(title)
  64. sleep(2)
  65. end
  66. end
  67. )
  68.  
  69. term.clear()
  70. term.setTextColor(colors.white)
  71. term.setCursorPos(1, 1)
  72.  
  73. -- Listen for the Enter key press
  74. while isRunning do
  75. local event, key = os.pullEvent("key")
  76. if event == "key" and key == keys.enter then
  77. runRecovery()
  78. end
  79. end
  80.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement