Advertisement
daandecomputer

Boot Options Daanos

Jul 17th, 2019
1,366
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.26 KB | None | 0 0
  1. function one()
  2. shell.run("nboot")
  3. end
  4. function two()
  5. shell.run("sboot")
  6. end
  7. local menuOptions = {"Normal-Boot", "Lightning(NoUpdate)-Boot"}
  8. local termX, termY = term.getSize()
  9. local selected = 1
  10. local strSeperator = string.rep(" ",5)
  11. function centerText(text, termY)
  12. term.setCursorPos(termX/2-#text/2, termY)
  13. term.write(text)
  14. end
  15. function start()
  16. while true do
  17. term.clear()
  18. local strMenuLine = "|"
  19. for i,v in ipairs(menuOptions) do
  20. if i == selected then
  21. strMenuLine = strMenuLine..strSeperator.."["..v.."]"
  22. else
  23. strMenuLine = strMenuLine..strSeperator.." "..v.." "
  24. end
  25. strMenuLine = strMenuLine..strSeperator.."|"
  26. end
  27. centerText("+"..string.rep("-",(#strMenuLine-2)).."+",1)
  28. centerText(strMenuLine,2)
  29. centerText("+"..string.rep("-",(#strMenuLine-2)).."+",3)
  30. local id, key = os.pullEvent()
  31. if id == "key" then
  32. if key == 205 then
  33. selected = selected + 1
  34. if selected > #menuOptions then
  35. selected = 1
  36. end
  37. elseif key == 203 then
  38. selected = selected - 1
  39. if selected < 1 then
  40. selected = #menuOptions
  41. end
  42. elseif key == 28 then
  43. return selected
  44. end
  45. end
  46. end
  47. end
  48. x = start()
  49. print()
  50. if x == 1 then
  51. one()
  52. end
  53. if x == 2 then
  54. two()
  55. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement