Advertisement
MJRLegends

MJRLegends Install Program

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