Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[This program will install any program that has from a floppy disk to a PC in the ComputerCraft mod for Minecraft©.
- 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'
- This will execute the installation, and you will need to fill in the required information about your program.
- 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
- programs, PM me on the minecraftforums, my username is mad1231999. Happy coding!
- ]]
- progName = "RedChat" --Your programs name here
- lockdone = "no"
- x = 0
- craftosversion = 1.2
- --This is what happens if the user tells the PC to launch your program
- function ifyes()
- sleep(1)
- shell.run(progName)
- end
- --This is what happens if the user tells the PC not to launch your program
- function ifnoorunknown()
- sleep(1)
- shell.run("clear")
- print("CraftOS ", craftosversion)
- end
- --Start of installation
- function installation()
- --This checks if the user has gone through this lock y/n thing, because the program can reset sometimes
- if lockdone == "no" then
- shell.run("clear")
- print("")
- print("")
- print(" Lock program? y/n")
- print("")
- write(" ")
- l = read()
- if l == "y" or l == "yes" then
- shell.run("clear")
- print("")
- print("")
- print(" Enter password:")
- print("")
- print("Password: ")
- print(" -----------------") --ALL this is the lock program, which is not functioning properly yet.
- print("Re-enter: ")
- print(" -----------------")
- term.setCursorPos(11, 5)
- pass = read("*")
- term.setCursorPos(11, 7)
- pass2 = read("*")
- --This is what happens if the two passwords did match
- if pass == pass2 then
- print(" Ok, this program is locked")
- sleep(2)
- lockdone = "yes"
- installation()
- else
- --This is what happens if the two passwords did not match
- print(" Password mismatch")
- sleep(2)
- installation()
- end
- elseif l == "n" or l == "no" then --This is what happens if the user does not want to lock the program
- lockdone = "yes"
- installation()
- else --Same is this
- lockdone = "yes"
- installation()
- end
- else
- --All this is the installation
- shell.run("clear")
- print("")
- print("")
- print(" Name of the program?")
- print("")
- write(" ")
- progName2 = read()
- shell.run("clear")
- progName = ("disk/"..progName2)
- fs.copy(progName, progName2) --LOOK AT THIS LINE BEFORE LAUNCHING
- shell.run("clear")
- print("")
- print("")
- write(" Installing ", progName2)
- while x < 6 do
- write(" .")
- x = x + 1
- sleep(0.5)
- end
- if x == 6 then
- print("")
- print("")
- write(" ", progName2, " installed")
- print("")
- print(" Launch ", progName2, "? y/n") --Here the PC asks if the user want to launch their program
- print("")
- write(" ")
- a = read()
- if a == "y" or a == "yes" then
- ifyes()
- elseif a == "n" or a == "no" then
- ifnoorunknown()
- else
- ifnoorunknown()
- end
- end
- end
- end
- installation()
Add Comment
Please, Sign In to add comment