Advertisement
Guest User

Gold Runner Installer

a guest
Jun 5th, 2013
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. local lpath = shell.resolve(".").."/goldrunner"
  2.  
  3. local exeCode = "bGdCnPmp"
  4. local levCodes = {
  5.     [1] = { code = "ibFSWdZM"; name = "warmup.nfp"; };
  6.     [2] = { code = "En1ZKwX6"; name = "homage.nfp"; };
  7.     [3] = { code = "aBstxN1B"; name = "pyramid.nfp"; };
  8.     [4] = { code = "neEApRwE"; name = "cavein.nfp"; };
  9.     [5] = { code = "uGuThknj"; name = "skyislands.nfp"; };
  10. }
  11.  
  12. if fs.exists(lpath) then
  13.     print(lpath.." already exists. Rename or use another directory to install.")
  14.     return
  15. end
  16.  
  17. print("GoldRunner Installer")
  18. print("\nInstalling to the following directory:")
  19. term.setTextColour(colours.yellow)
  20. print("  "..lpath.."\n")
  21. term.setTextColour(colours.white)
  22. term.write("Ready to install? Y/N: ")
  23.  
  24. while true do
  25.     local _,p1 = os.pullEvent("key")
  26.     if p1 == keys.y then
  27.         term.setTextColour(colours.lime)
  28.         print("Y\n")
  29.         break
  30.     elseif p1 == keys.n then
  31.         term.setTextColour(colours.red)
  32.         print("N\n")
  33.         return
  34.     end
  35. end
  36.  
  37. term.setTextColour(colours.white)
  38. term.write("Creating "..lpath.."... ")
  39. fs.makeDir(lpath)
  40. term.write("Creating "..lpath.."/levels... ")
  41. fs.makeDir("/"..lpath.."/levels")
  42.  
  43. term.setTextColour(colours.white)
  44. print("Downloading "..exeCode.."... ")
  45. if not shell.run("pastebin", "get", exeCode, lpath.."/GoldRunner") then
  46.     term.setTextColour(colours.red)
  47.     print("failed!")
  48.     return
  49. else
  50.     term.setTextColour(colours.lime)
  51.     print("complete.")
  52. end
  53.  
  54. for i=1,#levCodes do
  55.     term.setTextColour(colours.white)
  56.     print("Downloading "..levCodes[i].code.."... ")
  57.     if not shell.run("pastebin", "get", levCodes[i].code, lpath.."/levels/"..i.."_"..levCodes[i].name) then
  58.         term.setTextColour(colours.red)
  59.         print("failed!")
  60.         return
  61.     else
  62.         term.setTextColour(colours.lime)
  63.         print("complete.")
  64.     end
  65. end
  66.  
  67. print("Installation complete!")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement