Marlingaming

Aperture Science OS System - Base 01

Sep 15th, 2021 (edited)
158
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. --Aperture OS
  3. --this program acts as the base program for majority of my new programs, it handles startup, editing, etc
  4. --this program is for minecraft 1.16.5, CC Tweaked
  5. settings.load("SystemSettings")
  6. local w,h = term.getSize()
  7. local Version = "1.0"
  8. function CenterText(y,text)
  9. local x = math.floor((w - string.len(text)) /2)
  10. term.setCursorPos(x,y)
  11. term.clearLine()
  12. term.write(text)
  13. end
  14.  
  15. local nOption = 1
  16.  
  17. local function drawMenu()
  18. term.clear()
  19. term.setCursorPos(1,1)
  20. term.write("APERTURE OS v"..Version)
  21. term.setCursorPos(1,20)
  22. term.write("NEW MENU SCRIPT BEING DEVELOPED TO ALLOW COMBINATION OF BOTH MENU AND APP MENU")
  23. term.setCursorPos(1,2)
  24. shell.run("id")
  25. term.setCursorPos(w-11,1)
  26. if nOption == 1 then
  27. term.write("Command (WIP DONT USE)")
  28. elseif nOption == 2 then
  29. term.write("Programs")
  30. elseif nOption == 3 then
  31. term.write("Shutdown")
  32. elseif nOption == 4 then
  33. term.write("Find Update")
  34. else
  35. end
  36.  
  37. end
  38.  
  39. --gui
  40. term.clear()
  41. local function drawFrontend()
  42. CenterText( math.floor(h/2) - 3, "")
  43. CenterText( math.floor(h/2) - 2, "Start Menu")
  44. CenterText( math.floor(h/2) - 8, "")
  45. CenterText( math.floor(h/2) + 0, ((nOption == 1) and "[ Command ]") or "Command" )
  46. CenterText( math.floor(h/2) + 1, ((nOption == 2) and "[ Programs ]") or "Programs" )
  47. CenterText( math.floor(h/2) + 2, ((nOption == 3) and "[ Shutdown ]") or "Shutdown" )
  48. CenterText( math.floor(h/2) + 3, ((nOption == 4) and "[ Find Update ]") or "Find Update" )
  49. CenterText( math.floor(h/2) - 4, "")
  50. end
  51.  
  52. --display
  53. drawMenu()
  54. drawFrontend()
  55.  
  56. while true do
  57. local e,p = os.pullEvent()
  58. if e == "key" then
  59. local key = p
  60. if key == 17 or key == 200 then
  61.  
  62. if nOption > 1 then
  63. nOption = nOption - 1
  64. drawMenu()
  65. drawFrontend()
  66. end
  67. elseif key == 31 or key == 200 then
  68. if nOption < 4 then
  69. nOption = nOption + 1
  70. drawMenu()
  71. drawFrontend()
  72. end
  73. elseif key == 28 then
  74.  
  75. break
  76. end
  77. end
  78. end
  79. term.clear()
  80.  
  81. --conditions
  82. if nOption == 1 then --console
  83. shell.run("ApertureOS_ClientConsole") --client side Console
  84. elseif nOption == 2 then --programs
  85. shell.run("ApertureOS_ApplicationMenu") --client side App Menu
  86. elseif nOption == 3 then --shutdown
  87. shell.run("ShutdownPrompt")
  88. elseif nOption == 4 then --find updates
  89. shell.run("") --client side update search
  90. end
Add Comment
Please, Sign In to add comment