Advertisement
Guest User

startup

a guest
Feb 25th, 2020
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.42 KB | None | 0 0
  1. vs = "[BOS 1.2]"
  2. os.pullEvent = os.pullEventRaw
  3.  
  4. local w,h = term.getSize()
  5.  
  6. function printCentered( y,s )
  7.    local x = math.floor((w - string.len(s)) / 2)
  8.    term.setCursorPos(x,y)
  9.    term.clearLine()
  10.    term.write( s )
  11. end
  12.  
  13. local nOption = 1
  14.  
  15. local function drawMenu()
  16.    term.clear()
  17.    term.setCursorPos(1,1)
  18.    term.write(vs)
  19.    end
  20.  
  21. --GUI
  22. term.clear()
  23. local function drawFrontend()
  24.    printCentered( math.floor(h/2) - 3, "")
  25.    printCentered( math.floor(h/2) - 2, "Log In Menu" )
  26.    printCentered( math.floor(h/2) - 1, "")
  27.    printCentered( math.floor(h/2) + 0, ((nOption == 1) and "[Boppr]") or "Boppr" )
  28.    printCentered( math.floor(h/2) + 1, ((nOption == 2) and "[Bruh_Itz_Gary]") or "Bruh_Itz_Gary" )
  29.    printCentered( math.floor(h/2) + 2, "")
  30. end
  31.  
  32. --Display
  33. drawMenu()
  34. drawFrontend()
  35.  
  36. while true do
  37.  local e,p = os.pullEvent()
  38.  if e == "key" then
  39.   local key = p
  40.   if key == 17 or key == 200 then
  41.  
  42.    if nOption > 1 then
  43.     nOption = nOption - 1
  44.     drawFrontend()
  45.    end
  46.   elseif key == 31 or key == 208 then
  47.   if nOption < 4 then
  48.   nOption = nOption + 1
  49.   drawFrontend()
  50. end
  51. elseif key == 28 then
  52.     --End should not be here!!
  53. break
  54. end --End should be here!!
  55. end
  56. end
  57. term.clear()
  58.  
  59. --Conditions
  60. if nOption  == 1 then
  61. shell.run("boppr")
  62. elseif nOption == 2 then
  63. shell.run("ios/.programs")
  64. elseif nOption == 3 then
  65. os.shutdown()
  66. else
  67. shell.run("ios/.UninstallDialog")
  68. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement