Advertisement
HangMan23

theAdvancedOS.lua

Jan 25th, 2019
180
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.63 KB | None | 0 0
  1. local fs = require("filesystem")
  2. local gpu = require("component").gpu
  3. local unicode = require("unicode")
  4.  
  5. local s = {
  6. unicode.char(8730),
  7. unicode.char(9587),
  8. unicode.char(8681)
  9. }
  10.  
  11. print("Downloading files paths...")
  12. assert(loadfile("/bin/pastebin.lua"))("get", "-f", "FUFz0Wmg", "/lib/timlessPaths.lua")
  13.  
  14. local paths = require("timlessPaths")
  15.  
  16. print("Downloading ExtraUtilits library...")
  17. assert(loadfile("/bin/pastebin.lua"))("get", "-f", paths.ExtraUtilits, "/lib/ExtraUtilits.lua")
  18.  
  19. local EU = require("ExtraUtilits")
  20.  
  21. pclose = false
  22.  
  23. edit = {mode = true}
  24. mkdir = {mode = true}
  25.  
  26. edit.func = function()
  27.  
  28.   if edit.mode then
  29.  
  30.     buttons[2][6] = 0xff0000
  31.     buttons[2][7] = s[2]
  32.     edit.mode = false
  33.  
  34.   elseif not edit.mode then
  35.  
  36.     buttons[2][6] = 0x00ff00
  37.     buttons[2][7] = s[1]
  38.     edit.mode = true
  39.  
  40.   end
  41.  
  42. EU.draw(buttons)
  43.  
  44. end
  45.  
  46. mkdir.func = function()
  47.  
  48.   if mkdir.mode then
  49.  
  50.     buttons[3][6] = 0xff0000
  51.     buttons[3][7] = s[2]
  52.     mkdir.mode = false
  53.  
  54.   elseif not mkdir.mode then
  55.  
  56.     buttons[3][6] = 0x00ff00
  57.     buttons[3][7] = s[1]
  58.     mkdir.mode = true
  59.  
  60.   end
  61.  
  62. EU.draw(buttons)
  63.  
  64. end
  65.  
  66. function close()
  67.  
  68.   buttons.close = true
  69.   pclose = true
  70.  
  71. end
  72.  
  73. function download()
  74.  
  75.   buttons.close = true
  76.  
  77. end
  78.  
  79. function main()
  80.  
  81.   gpu.setBackground(0x323232)
  82.   gpu.fill(60, 20, 40, 20, " ")
  83.   gpu.set(63, 21, "/bin/edit.lua")
  84.   gpu.set(63, 22, "/bin/mkdir.lua")
  85.   gpu.setForeground(0xff8f40)
  86.   gpu.set(60, 20, "AdvancedOS V1.1")
  87.   gpu.set(62, 21, "|")
  88.   gpu.set(62, 22, "|")
  89.  
  90.  
  91.   buttons = {
  92.     {99, 20, 1, 1, 0x323232, 0xff0000, s[2], close},
  93.     {61, 21, 1, 1, 0x323232, 0x00ff00, s[1], edit.func},
  94.     {61, 22, 1, 1, 0x323232, 0x00ff00, s[1], mkdir.func},
  95.     {99, 39, 1, 1, 0x323232, 0x00ff00, s[3], download}
  96.   }
  97.  
  98.   EU.draw(buttons)
  99.  
  100.   EU.buttonPress(buttons)
  101.  
  102.   if not pclose then
  103.  
  104.     if edit.mode then
  105.  
  106.       gpu.setBackground(0xff0000)
  107.       gpu.set(98, 21, " ")
  108.       gpu.set(98, 22, " ")
  109.  
  110.       gpu.setBackground(0x323232)
  111.       gpu.setForeground(0xff8f40)
  112.       gpu.set(60, 39, "Downloading edit.lua...")
  113.       os.sleep(1)
  114.  
  115.       assert(loadfile("/bin/pastebin.lua"))("get", "-f", paths.edit, "/bin/edit.lua")
  116.  
  117.       gpu.setBackground(0x00ff00)
  118.       gpu.set(98, 21, " ")
  119.  
  120.     end
  121.  
  122.     if mkdir.mode then
  123.  
  124.       gpu.setBackground(0x323232)
  125.       gpu.setForeground(0xff8f40)
  126.       gpu.set(60, 39, "Downloading mkdir.lua...")    
  127.       os.sleep(1)
  128.  
  129.       assert(loadfile("/bin/pastebin.lua"))("get", "-f", paths.mkdir, "/bin/mkdir.lua")
  130.  
  131.       gpu.setBackground(0x00ff00)
  132.       gpu.set(98, 22, " ")
  133.  
  134.     end    
  135.  
  136.   end
  137.  
  138. end
  139.  
  140. EU.screenBackup(main)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement