wv1106

generalInstaller

Jul 2nd, 2022 (edited)
503
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.75 KB | None
  1. function computerInstaller()
  2.     term.clear()
  3.     term.setCursorPos(1, 1)
  4.  
  5.     shell.run("pastebin", "get", "P8UG6HQ7", "/startup")
  6.  
  7.  
  8.     term.write("done!")
  9.     os.pullEvent("key")
  10. end
  11.  
  12. function turtleInstaller()
  13.     term.clear()
  14.     term.setCursorPos(1, 1)
  15.  
  16.  
  17.     fs.makeDir("/programs")
  18.     shell.run("pastebin", "get", "t8ge8bfZ", "/programs/stripmine")
  19.     shell.run("pastebin", "get", "WQqc03us", "/programs/excavate")
  20.     shell.run("pastebin", "get", "hJ6LnRtq", "/programs/bridge")
  21.     shell.run("pastebin", "get", "kPhFUSUp", "/programs/lavaRefuel")
  22.     shell.run("pastebin", "get", "P8UG6HQ7", "/startup")
  23.  
  24.  
  25.     term.write("done!")
  26.     os.pullEvent("key")
  27. end
  28.  
  29. function compactComputerInstaller()
  30.     term.clear()
  31.     term.setCursorPos(1, 1)
  32.  
  33.     shell.run("pastebin", "get", "ksHXdwML", "/startup")
  34.  
  35.  
  36.     term.write("done!")
  37.     os.pullEvent("key")
  38. end
  39.  
  40. selected = 1
  41. devices = {
  42.     {"computer", computerInstaller},
  43.     {"turtle", turtleInstaller},
  44.     {"compactComputer", compactComputerInstaller},
  45. }
  46. while true do
  47.     term.clear()
  48.     term.setCursorPos(3, 1)
  49.     term.write("Installer")
  50.     term.setCursorPos(1, 5)
  51.     for i, value in ipairs(devices) do
  52.         term.write(value[1])
  53.         if selected==i then
  54.             print(" <-")
  55.         else
  56.             print("")
  57.         end
  58.     end
  59.  
  60.     local event, key, isheld = os.pullEvent("key")
  61.     if(key==keys.up and not isheld)then
  62.         selected=selected-1
  63.     elseif(key==keys.down and not isheld)then
  64.         selected=selected+1
  65.     elseif(key==keys.enter)then
  66.         devices[selected][2]()
  67.         break
  68.        
  69.     end
  70.  
  71.     if(selected<1)then
  72.         selected=#devices
  73.     elseif(selected>#devices)then
  74.         selected=1
  75.     end
  76. end
  77.  
  78. os.reboot()
RAW Paste Data Copied