Advertisement
DOGGYWOOF

Untitled

Nov 2nd, 2024 (edited)
12
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.63 KB | None | 0 0
  1. os.pullEvent = os.pullEventRaw
  2.  
  3. if not multishell then
  4. term.clear()
  5. term.setCursorPos(1, 1)
  6. print("Error: Multishell is not available on this system.")
  7. print("Press Enter to exit.")
  8. read()
  9. return
  10. else
  11. -- Center the text within the given width
  12. function centerText(text, width)
  13. local padding = math.max(0, math.floor((width - #text) / 2))
  14. return string.rep(" ", padding) .. text
  15. end
  16.  
  17. -- Draw a border with specified width and height
  18. function drawBorder(width, height)
  19. term.setCursorPos(1, 1)
  20. term.write("+" .. string.rep("-", width - 2) .. "+")
  21. for i = 2, height - 1 do
  22. term.setCursorPos(1, i)
  23. term.write("|")
  24. term.setCursorPos(width, i)
  25. term.write("|")
  26. end
  27. term.setCursorPos(1, height)
  28. term.write("+" .. string.rep("-", width - 2) .. "+")
  29. end
  30.  
  31. -- Draw the centered text with more spacing
  32. function drawCenteredText(width, height)
  33. term.setCursorPos(2, 2)
  34. drawBorder(width, height)
  35.  
  36. local y = 4
  37. term.setCursorPos(3, y)
  38. print(centerText("Doggy OS Installation Media", width - 4))
  39.  
  40. y = y + 2
  41. term.setCursorPos(3, y)
  42. print(centerText("OS VERSION: Doggy OS 13.0", width - 4))
  43.  
  44. y = y + 1
  45. term.setCursorPos(3, y)
  46. print(centerText("UEFI: DOGGY OS UEFI CONFIG (N3K0)", width - 4))
  47.  
  48. y = y + 1
  49. term.setCursorPos(3, y)
  50. print(centerText("BOOTLOADER: VA11-ILLA 13.0", width - 4))
  51.  
  52. y = y + 3
  53. term.setCursorPos(3, y)
  54. print(centerText("Confirm Install", width - 4))
  55.  
  56. y = y + 1
  57. term.setCursorPos(3, y)
  58. print(centerText("Y: Install OS", width - 4))
  59.  
  60. y = y + 1
  61. term.setCursorPos(3, y)
  62. print(centerText("N: Cancel Install", width - 4))
  63.  
  64. y = y + 3
  65. term.setCursorPos(3, y)
  66. print(centerText("===================================", width - 4))
  67. end
  68.  
  69. function main()
  70. term.clear()
  71. local w, h = term.getSize()
  72. local contentHeight = 16
  73. local borderPadding = 2 -- Padding between border and content
  74.  
  75. -- Adjust height for border padding
  76. local heightWithBorders = contentHeight + borderPadding * 2
  77.  
  78. -- Make sure the height fits within the screen
  79. local displayHeight = math.min(h, heightWithBorders)
  80. drawCenteredText(w, displayHeight)
  81.  
  82. -- Read user input
  83. term.setCursorPos(3, displayHeight - 1)
  84. local user_input = read()
  85.  
  86. if user_input:lower() == 'y' then
  87. runProgram()
  88. elseif user_input:lower() == 'n' then
  89. term.clear()
  90. term.setCursorPos(1, 1)
  91. drawBorder(w, 7)
  92. term.setCursorPos(3, 2)
  93. print(centerText("The Installation Was Cancelled!", w - 4))
  94. term.setCursorPos(3, 3)
  95. print(centerText("Shutting Down...", w - 4))
  96. sleep(4)
  97. os.shutdown()
  98. else
  99. shell.run("/disk/startup")
  100. main()
  101. end
  102. end
  103.  
  104. function runProgram()
  105. -- Replace the following line with the code to run your desired program
  106. shell.run("/disk/install") -- Replace with your actual program name
  107.  
  108. term.clear()
  109. term.setCursorPos(1,1)
  110. print("Doggy OS Install error")
  111. print("====================================")
  112. print("Unable to load installation program")
  113. print("Press enter to retry")
  114. read()
  115. os.reboot()
  116. end
  117.  
  118. main()
  119. end
  120.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement