Advertisement
daandecomputer

Untitled

Jan 6th, 2019
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function one()
  2. print("We are sad that you go :(")
  3. print("Uninstalling....")
  4. shell.run("delete *")
  5. shell.run("delete startup")
  6. os.reboot()
  7.  
  8. end
  9. function two()
  10. shell.run("pastebin get vNd0Jyw8 Paste-menu")
  11. shell.run("background Paste-menu")
  12. end
  13. function three()
  14. shell.run("menu2")
  15. end
  16. function four()
  17. os.shutdown()
  18. end
  19. local menuOptions = {"Uninstall", "Installer maker", "Back"}
  20. local termX, termY = term.getSize()
  21. local selected = 1
  22. local strSeperator = string.rep(" ",5)
  23. function centerText(text, termY)
  24. term.setCursorPos(termX/2-#text/2, termY)
  25. term.write(text)
  26. end
  27. function start()
  28. while true do
  29. term.clear()
  30. local strMenuLine = "|"
  31. for i,v in ipairs(menuOptions) do
  32. if i == selected then
  33. strMenuLine = strMenuLine..strSeperator.."["..v.."]"
  34. else
  35. strMenuLine = strMenuLine..strSeperator.." "..v.." "
  36. end
  37. strMenuLine = strMenuLine..strSeperator.."|"
  38. end
  39. centerText("+"..string.rep("-",(#strMenuLine-2)).."+",1)
  40. centerText(strMenuLine,2)
  41. centerText("+"..string.rep("-",(#strMenuLine-2)).."+",3)
  42. local id, key = os.pullEvent()
  43. if id == "key" then
  44. if key == 205 then
  45. selected = selected + 1
  46. if selected > #menuOptions then
  47. selected = 1
  48. end
  49. elseif key == 203 then
  50. selected = selected - 1
  51. if selected < 1 then
  52. selected = #menuOptions
  53. end
  54. elseif key == 28 then
  55. return selected
  56. end
  57. end
  58. end
  59. end
  60. x = start()
  61. print()
  62. if x == 1 then
  63. one()
  64. end
  65. if x == 2 then
  66. two()
  67. end
  68. if x == 3 then
  69. three()
  70. end
  71. if x == 4 then
  72. four()
  73. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement