JustDoesGames

update_Turtos_2019

Jun 29th, 2019
198
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.11 KB | None | 0 0
  1. -- Update File --
  2. --[[
  3.  
  4. If you are reading this, Know that you are smart...
  5.  
  6. ]]
  7.  
  8. local version = "v1_0"
  9.  
  10. function req_update()
  11.     shell.run("clear")
  12.     term.setTextColor(colors["lightGray"])
  13.     local sx,sy = term.getSize()
  14.     for i=1, sx do
  15.         write("=")
  16.     end
  17.     term.setCursorPos(1,sy-1)
  18.     for i=1, sx do
  19.         write("=")
  20.     end
  21.     term.setCursorPos(1,1)
  22.     for i=1, sy-1 do
  23.         print("#")
  24.     end
  25.     for i=1, sy-2 do
  26.         term.setCursorPos(sx,i)
  27.         write("#")
  28.     end
  29.     term.setCursorPos(2,2)
  30.     write("Update to "..version.."?")
  31.     local selected = 1
  32.     local menu = {"Yes, Update!", "No, Continue."}
  33.     repeat
  34.         for i=1, #menu do
  35.             term.setCursorPos(2,i+3)
  36.             if i == selected then
  37.                 term.setTextColor(colors["white"])
  38.                 print("> "..menu[i])
  39.             else
  40.                 term.setTextColor(colors["gray"])
  41.                 print("  "..menu[i])
  42.             end
  43.         end
  44.         a,i = os.pullEvent("key")
  45.         if i == keys.w or i == keys.up then
  46.             if selected ~= 1 then selected = 1 end
  47.         elseif i == keys.s or i == keys.down then
  48.             if selected ~= 2 then selected = 2 end
  49.         end
  50.     until i == keys.enter or i == keys.e
  51. end
  52.  
  53. if not fs.exists(version) then
  54.     req_update()
  55. end
Advertisement
Add Comment
Please, Sign In to add comment