Guest User

Untitled

a guest
May 25th, 2018
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.21 KB | None | 0 0
  1. --[[This program will install any program that has from a floppy disk to a PC in the ComputerCraft mod for Minecraft©.
  2.     This program is supposed to be on a floppy disk, and when you insert the disk into the PC, you type 'cd disk', and then you type 'installer'
  3.     This will execute the installation, and you will need to fill in the required information about your program.
  4.     The program was made by me, Mads Clausen, 16/1-2012 DD/MM-YYYY. If you got any questions about this code or any of my other
  5.     programs, PM me on the minecraftforums, my username is mad1231999. Happy coding!
  6.     ]]
  7. progName = "RedChat" --Your programs name here
  8. lockdone = "no"
  9. x = 0
  10. craftosversion = 1.2
  11.  
  12. --This is what happens if the user tells the PC to launch your program
  13. function ifyes()
  14.     sleep(1)
  15.     shell.run(progName)
  16. end
  17.  
  18. --This is what happens if the user tells the PC not to launch your program
  19. function ifnoorunknown()
  20.     sleep(1)
  21.     shell.run("clear")
  22.     print("CraftOS ", craftosversion)
  23. end
  24.  
  25. --Start of installation
  26. function installation()
  27.    
  28.     --This checks if the user has gone through this lock y/n thing, because the program can reset sometimes
  29.     if lockdone == "no" then
  30.         shell.run("clear")
  31.         print("")
  32.         print("")
  33.         print("          Lock program? y/n")
  34.         print("")
  35.         write("                  ")
  36.         l = read()
  37.         if l == "y" or l == "yes" then
  38.             shell.run("clear")
  39.             print("")
  40.             print("")
  41.             print("          Enter password:")
  42.             print("")
  43.             print("Password: ")
  44.             print("         -----------------")     --ALL this is the lock program, which is not functioning properly yet.
  45.             print("Re-enter: ")
  46.             print("         -----------------")
  47.             term.setCursorPos(11, 5)
  48.             pass = read("*")
  49.             term.setCursorPos(11, 7)
  50.             pass2 = read("*")
  51.            
  52.             --This is what happens if the two passwords did match
  53.             if pass == pass2 then
  54.                 print("          Ok, this program is locked")
  55.                 sleep(2)
  56.                 lockdone = "yes"
  57.                 installation()
  58.             else
  59.            
  60.                 --This is what happens if the two passwords did not match
  61.                 print("          Password mismatch")
  62.                 sleep(2)
  63.                 installation()
  64.             end
  65.         elseif l == "n" or l == "no" then --This is what happens if the user does not want to lock the program
  66.             lockdone = "yes"
  67.             installation()
  68.         else                              --Same is this
  69.             lockdone = "yes"
  70.             installation()
  71.         end
  72.     else
  73.        
  74.         --All this is the installation
  75.         shell.run("clear")
  76.         print("")
  77.         print("")
  78.         print("          Name of the program?")
  79.         print("")
  80.         write("          ")
  81.         progName2 = read()
  82.         shell.run("clear")
  83.         progName = ("disk/"..progName2)
  84.         fs.copy(progName, progName2)  --LOOK AT THIS LINE BEFORE LAUNCHING
  85.         shell.run("clear")
  86.         print("")
  87.         print("")
  88.         write("          Installing ", progName2)
  89.         while x < 6 do
  90.             write(" .")
  91.             x = x + 1
  92.             sleep(0.5)
  93.         end
  94.         if x == 6 then
  95.             print("")
  96.             print("")
  97.             write("          ", progName2, " installed")
  98.             print("")
  99.             print("          Launch ", progName2, "? y/n")  --Here the PC asks if the user want to launch their program
  100.             print("")
  101.             write("                  ")
  102.             a = read()
  103.             if a == "y" or a == "yes" then
  104.                 ifyes()
  105.             elseif a == "n" or a == "no" then
  106.                 ifnoorunknown()
  107.             else
  108.                 ifnoorunknown()
  109.             end
  110.         end
  111.         end
  112.     end
  113. installation()
Add Comment
Please, Sign In to add comment