MJRLegends

MJRLegends Install Program

Feb 28th, 2016 (edited)
1,497
1
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 8.02 KB | None | 1 0
  1. ----------- Made BY MJRLegends (Please dont claim as your own code) -----------
  2. version = "2.0.2"
  3.  
  4. --Main Programs
  5. reactorProgram = "CJMFJUEb"
  6. reactorProgramSmartHelmet = "GyZmQB4B"
  7. tubineProgram = "jynMAHYQ"
  8. tubineProgramSmartHelmet = "MYk7Nz45"
  9. fusionreactorProgram = "pk8B7fAM"
  10. newFusionreactorProgram = "5nCJ4QZb"
  11. newFusionreactorProgram2 = "LShKv72C"
  12. energyProgram = "RYN6uUf7"
  13. thermalEvaporationProgram = "9txmi9Q4"
  14. railcraftTanksProgram = "cN7scp9W"
  15.  
  16. --Other Programs
  17. reactorSimpleProgram = "ktBqnfmn"
  18. tubineSimpleProgram = "LWJ9SYw3"
  19.  
  20. latestVerions = "wL3rVUqN"
  21. selection = 0
  22. menu = "mainmenu"
  23.  
  24. function addToCurrentVersions()
  25.     if fs.exists("versions.txt") then
  26.         fs.delete("versions.txt")
  27.     end
  28.     if fs.exists("currentVersions.txt") then
  29.         fs.delete("currentVersions.txt")
  30.     end
  31.    
  32.     shell.run("pastebin get ".. latestVerions .." versions.txt")
  33.     local latestVersions = {}
  34.     file = fs.open("versions.txt","r")
  35.     listElement = file.readLine()
  36.     while listElement do
  37.         table.insert(latestVersions,listElement)
  38.         listElement = file.readLine()
  39.     end
  40.     file.close()
  41.     shell.run("rm versions.txt")
  42.     local file = fs.open("currentVersions.txt","a")
  43.     file.writeLine(latestVersions[tonumber(selection)])
  44.     file.close()
  45. end
  46.  
  47. --Other Programs Menu
  48. function otherPrograms()
  49.     selection = 0
  50.     term.clear()
  51.     term.setBackgroundColor(colors.black)
  52.     term.setTextColor(colors.blue)
  53.     term.setCursorPos(1,1)
  54.     term.write("MJRLegends Other Programs!")
  55.     term.setTextColor(colors.cyan)
  56.     print("")
  57.     print("Enter a number for the program you want to install:")
  58.     term.setTextColor(colors.white)
  59.     print("1 - Simple Display Reactor Info (Monitor Edition)")
  60.     print("2 - Simple Display Turbine Info (Monitor Edition)")
  61.     term.setTextColor(colors.blue)
  62.     print("3 - Back to Main Menu")
  63.     term.setTextColor(colors.cyan)
  64.    
  65.     selection = read()
  66.     --Choice depending on what the user types
  67.     if selection == "1" then
  68.         if fs.exists("startup") then
  69.             fs.delete("startup")
  70.         end
  71.         shell.run("pastebin get " .. reactorSimpleProgram .. " startup")
  72.         print("Installed!")
  73.         print("Restart the computer using (Ctrl + R)!")
  74.     elseif selection == "2" then
  75.         if fs.exists("startup") then
  76.             fs.delete("startup")
  77.         end
  78.         shell.run("pastebin get " .. tubineSimpleProgram .. " startup")
  79.         print("Installed!")
  80.         print("Restart the computer using (Ctrl + R)!")
  81.     elseif selection == "3" then
  82.         selection = 0
  83.         mainMenu()
  84.     else
  85.         print("Unknown Program!")
  86.     end
  87. end
  88.  
  89. function mainMenu()
  90.     if selection == 0 then
  91.         -- Main Menu
  92.         term.clear()
  93.         term.setBackgroundColor(colors.black)
  94.         term.setTextColor(colors.blue)
  95.         term.setCursorPos(1,1)
  96.         term.write("Welcome to MJRLegends Install Program! V" .. version)
  97.         term.setTextColor(colors.cyan)
  98.         term.setCursorPos(1,2)
  99.         print("Enter a number for the program you want to install:")
  100.         term.setTextColor(colors.white)
  101.         print("1 - Reactor Management(BR/Monitor Edition)")
  102.         print("2 - Reactor Management(BR/Smart Helmet Edition)")
  103.         print("3 - Turbine Management(BR/Monitor Edition)")
  104.         print("4 - Turbine Management(BR/Smart Helmet Edition)")
  105.         print("5 - Fusion Reactor Management(Mekanism 8)")
  106.         print("6 - Fusion Reactor Management(Mekanism 9)")
  107.         print("7 - Fusion Reactor Management(Mekanism 10+)")
  108.         print("8 - Energy Management")
  109.         print("9 - Thermal Evaporation Display (Mekanism 9+)")
  110.         print("10 - RailCraft Tanks Display")
  111.         term.setTextColor(colors.yellow)
  112.         print("11- Versions")
  113.         term.setTextColor(colors.lime)
  114.         print("12- Other Programs")
  115.         term.setTextColor(colors.cyan)
  116.  
  117.         selection = read()
  118.         term.setTextColor(colors.white)
  119.     end
  120.     --Choice depending on what the user types
  121.     if selection == "1" then
  122.         if fs.exists("startup") then
  123.             fs.delete("startup")
  124.         end
  125.         shell.run("pastebin get " .. reactorProgram .. " startup")
  126.         print("Installed!")
  127.         print("Restart the computer using (Ctrl + R)!")
  128.         addToCurrentVersions()
  129.         return
  130.     elseif selection == "2" then
  131.         if fs.exists("startup") then
  132.             fs.delete("startup")
  133.         end
  134.         shell.run("pastebin get " .. reactorProgramSmartHelmet .. " startup")
  135.         print("Installed!")
  136.         print("Restart the computer using (Ctrl + R)!")
  137.         addToCurrentVersions()
  138.         return
  139.     elseif selection == "3" then
  140.         if fs.exists("startup") then
  141.             fs.delete("startup")
  142.         end
  143.         shell.run("pastebin get " .. tubineProgram .. " startup")
  144.         print("Installed!")
  145.         print("Restart the computer using (Ctrl + R)!")
  146.         addToCurrentVersions()
  147.         return
  148.     elseif selection == "4" then
  149.         if fs.exists("startup") then
  150.             fs.delete("startup")
  151.         end
  152.         shell.run("pastebin get " .. tubineProgramSmartHelmet .. " startup")
  153.         print("Installed!")
  154.         print("Restart the computer using (Ctrl + R)!")
  155.         addToCurrentVersions()
  156.         return
  157.     elseif selection == "5" then
  158.         if fs.exists("startup") then
  159.             fs.delete("startup")
  160.         end
  161.         shell.run("pastebin get " .. fusionreactorProgram .. " startup")
  162.         print("Installed!")
  163.         print("Restart the computer using (Ctrl + R)!")
  164.         addToCurrentVersions()
  165.         return
  166.     elseif selection == "6" then
  167.         if fs.exists("startup") then
  168.             fs.delete("startup")
  169.         end
  170.         shell.run("pastebin get " .. newFusionreactorProgram .. " startup")
  171.         print("Installed!")
  172.         print("Restart the computer using (Ctrl + R)!")
  173.         addToCurrentVersions()
  174.         return
  175.     elseif selection == "7" then
  176.         if fs.exists("startup") then
  177.             fs.delete("startup")
  178.         end
  179.         shell.run("pastebin get " .. newFusionreactorProgram2 .. " startup")
  180.         print("Installed!")
  181.         print("Restart the computer using (Ctrl + R)!")
  182.         addToCurrentVersions()
  183.         return
  184.     elseif selection == "8" then
  185.         if fs.exists("startup") then
  186.             fs.delete("startup")
  187.         end
  188.         shell.run("pastebin get " .. energyProgram .. " startup")
  189.         print("Installed!")
  190.         print("Restart the computer using (Ctrl + R)!")
  191.         addToCurrentVersions()
  192.         return
  193.     elseif selection == "9" then
  194.         if fs.exists("startup") then
  195.             fs.delete("startup")
  196.         end
  197.         shell.run("pastebin get " .. thermalEvaporationProgram .. " startup")
  198.         print("Installed!")
  199.         print("Restart the computer using (Ctrl + R)!")
  200.         addToCurrentVersions()
  201.         return
  202.     elseif selection == "10" then
  203.         if fs.exists("startup") then
  204.             fs.delete("startup")
  205.         end
  206.         shell.run("pastebin get " .. railcraftTanksProgram .. " startup")
  207.         print("Installed!")
  208.         print("Restart the computer using (Ctrl + R)!")
  209.         addToCurrentVersions()
  210.         return
  211.     elseif selection == "11" then
  212.         if fs.exists("versions.txt") then
  213.             fs.delete("versions.txt")
  214.         end
  215.        
  216.         --See Latest versions
  217.         shell.run("pastebin get ".. latestVerions .." versions.txt")
  218.         local latestVersions = {}
  219.         file = fs.open("versions.txt","r")
  220.         listElement = file.readLine()
  221.         while listElement do
  222.             table.insert(latestVersions,listElement)
  223.             listElement = file.readLine()
  224.         end
  225.         file.close()
  226.         term.clear()
  227.         term.setTextColor(colors.blue)
  228.         term.setCursorPos(1,1)
  229.         term.write("Latest Versions")
  230.         yLevel = 2
  231.         for i,v in pairs(latestVersions) do
  232.             if (yLevel % 2 == 0) then
  233.                 term.setTextColor(colors.yellow)
  234.             else
  235.                 term.setTextColor(colors.lime)
  236.             end
  237.             term.setCursorPos(1,yLevel)
  238.             term.write(v)
  239.             yLevel = yLevel + 1
  240.         end
  241.         yLevel = yLevel - 1
  242.         --See Current versions
  243.         if fs.exists("currentVersions.txt") then
  244.             yLevel = yLevel + 1
  245.             term.setTextColor(colors.blue)
  246.             term.setCursorPos(1,yLevel)
  247.             term.write("Current Versions")
  248.             yLevel = yLevel+1
  249.             local currentVersions = {}
  250.             file = fs.open("currentVersions.txt","r")
  251.             listElement2 = file.readLine()
  252.             while listElement2 do
  253.                 table.insert(currentVersions,listElement2)
  254.                 listElement2 = file.readLine()
  255.             end
  256.             file.close()
  257.                
  258.             for i,v in pairs(currentVersions) do
  259.                 term.setTextColor(colors.yellow)
  260.                 term.setCursorPos(1,yLevel)
  261.                 term.write(v)
  262.                 yLevel = yLevel + 1
  263.             end
  264.             print()
  265.         end
  266.         print()
  267.         term.setTextColor(colors.blue)
  268.         print("1 - Back to Main Menu")
  269.         selection = 0
  270.         selection = read()
  271.         if selection == "1" then
  272.             selection = 0
  273.             mainMenu()
  274.         end
  275.     elseif selection == "12" then
  276.         otherPrograms()
  277.     else
  278.         print("Unknown Program!")
  279.     end
  280. end
  281.  
  282. if selection == 0 then
  283.     mainMenu()
  284. end
Advertisement
Add Comment
Please, Sign In to add comment