JustDoesGames

BasicOS

Jun 12th, 2019
271
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.62 KB | None | 0 0
  1. --[[ BasicOS ]]--
  2. --[[ Just Does Games ]]--
  3.  
  4.  
  5. --[[ FUNCTIONS ]]--
  6.  
  7. function clr() term.clear() end
  8. function cp(x,y) term.setCursorPos(x,y) end
  9. function sb(col) term.setBackgroundColor(colors[col]) end
  10. function st(col) term.setTextColor(colors[col]) end
  11.  
  12. --[[ FUNCTIONS ]]--
  13.  
  14.  
  15. --[[ INSTALL ]]--
  16.  
  17. function install()
  18.     drawScreen() sb("lightGray")
  19.     cp(1,5) print("BasicOS if a simple to use and install opperating system used for the simple and more advanced commands, options, and common security for your computer.")
  20.     repeat
  21.         a,i = os.pullEvent("key")
  22.     until i == keys.right or i == keys.d
  23.     drawScreen() cp(1,5)
  24.     print("Files to be added:")
  25.     print(" "..string.char(187).." BasicOS/main.lua")
  26.     print(" "..string.char(187).." BasicOS/config.lua")
  27.     print(" "..string.char(187).." BasicOS/MenuAPI/MenuAPI.lua") cp(1,10)
  28.     print("Press "..string.char(16).." to continue")
  29.     repeat
  30.         a,i = os.pullEvent("key")
  31.     until i == keys.right or i == keys.d
  32.     drawScreen()
  33.     print("Do you wish to install BasicOS and agree to all the files created via through Pastebin or installer?") print("")
  34.     local cpx,cpy = term.getCursorPos()
  35.     local running = true local sel = 1
  36.     while running do
  37.         cp(cpx,cpy)
  38.         if sel == 1 then
  39.             displayText(string.char(187).."Deny")
  40.             displayText(" Accept")
  41.         else
  42.             displayText(" Deny")
  43.             displayText(string.char(187).."Accept")
  44.         end
  45.         a,i = os.pullEvent("key")
  46.         if i == keys.w or i == keys.up then
  47.             if sel ~= 1 then sel = 1 end
  48.         elseif i == keys.s or i == keys.down then
  49.             if sel ~= 2 then sel = 2 end
  50.         elseif i == keys.e or i == keys.enter then
  51.             running = false
  52.         end
  53.     end
  54.     if sel == 2 then
  55.         -- attempt to install via pastebin
  56.         -- failed: extract from here (copy MenuAPI to this file... main already included... config is blank for now)
  57.     else
  58.         sb("black") st("white") clr() cp(1,1)
  59.     end
  60. end
  61.  
  62. function drawScreen()
  63.     sb("lightGray") clr() cp(1,sy) sb("gray") for i=1, sx do write(" ") end cp(sx,sy) st("white") write(string.char(16)) sb("white") cp(1,1)
  64.     st("black") displayText(" Welcome to BasicOS! ") cp(1,2) displayText(" Installer ") cp(1,3) sb("gray") for i=1, sx do write(" ") end sb("lightGray")
  65. end
  66.  
  67. function displayText(text)
  68.     local x,y = term.getSize()
  69.     local x2,y2 = term.getCursorPos()
  70.     term.setCursorPos(math.ceil((x / 2) - (text:len() / 2)), y2)
  71.     print(text)
  72. end
  73.  
  74. --[[ INSTALL ]]--
  75.  
  76.  
  77. --[[ INIT ]]--
  78.  
  79. sx,sy = term.getSize()
  80. color = term.isColor()
  81.  
  82. if fs.exists("BasicOS/config.lua") == false or shell.getRunningProgram() ~= "BasicOS/main.lua" then
  83.     install()
  84. end
  85.  
  86. --[[ INIT ]]--
  87.  
  88. --[[ VARIABLES ]]--
  89. --[[ VARIABLES ]]--
  90.  
  91.  
  92. --[[ SECURITY ]]--
  93. --[[ SECURITY ]]--
Advertisement
Add Comment
Please, Sign In to add comment