Advertisement
DOGGYWOOF

Untitled

Jul 24th, 2024 (edited)
9
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.37 KB | None | 0 0
  1. os.pullEvent = os.pullEventRaw
  2.  
  3. function centerText(text, width)
  4. local padding = math.max(0, math.floor((width - #text) / 2))
  5. return string.rep(" ", padding) .. text
  6. end
  7.  
  8. function drawBorder(width, height)
  9. term.setCursorPos(1, 1)
  10. term.write("+" .. string.rep("-", width - 2) .. "+")
  11. for i = 2, height - 1 do
  12. term.setCursorPos(1, i)
  13. term.write("|")
  14. term.setCursorPos(width, i)
  15. term.write("|")
  16. end
  17. term.setCursorPos(1, height)
  18. term.write("+" .. string.rep("-", width - 2) .. "+")
  19. end
  20.  
  21. function drawCenteredText(width, height)
  22. term.setCursorPos(2, 2)
  23. drawBorder(width, height)
  24.  
  25. local y = 4
  26. term.setCursorPos(3, y)
  27. print(centerText("Doggy OS Installation Media", width - 4))
  28.  
  29. y = y + 1
  30. term.setCursorPos(3, y)
  31. print(centerText("OS VERSION: Doggy OS 13.0", width - 4))
  32.  
  33. y = y + 1
  34. term.setCursorPos(3, y)
  35. print(centerText("UEFI: N3K0 UEFI", width - 4))
  36.  
  37. y = y + 1
  38. term.setCursorPos(3, y)
  39. print(centerText("BOOTLOADER: VA11-ILLA 12.0", width - 4))
  40.  
  41. y = y + 2
  42. term.setCursorPos(3, y)
  43. print(centerText("Confirm Install", width - 4))
  44.  
  45. y = y + 1
  46. term.setCursorPos(3, y)
  47. print(centerText("Y: Install OS", width - 4))
  48.  
  49. y = y + 1
  50. term.setCursorPos(3, y)
  51. print(centerText("N: Cancel Install", width - 4))
  52.  
  53. y = y + 2
  54. term.setCursorPos(3, y)
  55. print(centerText("===================================", width - 4))
  56. end
  57.  
  58. function main()
  59. term.clear()
  60. local w, h = term.getSize()
  61. local contentHeight = 12
  62. drawCenteredText(w, contentHeight + 4)
  63.  
  64. term.setCursorPos(3, contentHeight + 5)
  65. local user_input = read()
  66.  
  67. if user_input:lower() == 'y' then
  68. runProgram()
  69. elseif user_input:lower() == 'n' then
  70. term.clear()
  71. term.setCursorPos(1, 1)
  72. drawBorder(w, 7)
  73. term.setCursorPos(3, 2)
  74. print(centerText("The Installation Was Cancelled!", w - 4))
  75. term.setCursorPos(3, 3)
  76. print(centerText("Shutting Down...", w - 4))
  77. sleep(4)
  78. os.shutdown()
  79. else
  80. shell.run("/disk/startup")
  81. main()
  82. end
  83. end
  84.  
  85. function runProgram()
  86. -- Replace the following line with the code to run your desired program
  87. shell.run("/disk/install") -- Replace with your actual program name
  88. end
  89.  
  90. main()
  91.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement