Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- shell.run("clear")
- local booColor = false -- Create variable local to only the function
- if term.isColor ~= nil then -- Test to see if term.isColor even exists within ComputerCraft
- booColor = term.isColor() -- If it is then set the booColor to either true or false
- if booColor == false then
- print("TrinaryAtom code detects this is a normal computer and installation will not start.") -- This will trigger if on a Stone Computer of the latest version
- else
- print("TrinaryAtom code detects this is a color computer and installation will start.") -- This will trigger if on a Advanced Computer of the latest version
- os.pullEvent()
- term.setBackgroundColor(colors.blue)
- term.clear()
- root = "http://www.lozengia.com/tmas/Downloads/Minecraft/Cmon/3/"
- print("Installing Craftmon from:" .. root)
- print("Defining Funtions")
- function setdir(directory)
- if fs.exists(directory) == false then
- fs.makeDir(directory)
- end
- end
- function downloadfile(file)
- if fs.exists(file) then
- fs.delete( file )
- end
- local response = http.get(root .. file)
- if response then
- while response do
- local sResponse = response.readAll()
- response.close()
- cache = shell.resolve( file )
- local file = fs.open( cache, "w" )
- file.write( sResponse )
- file.close()
- response = nil
- end
- end
- end
- print("Defining Game Directorys to install")
- directorys = { "Craftmon", "Craftmon/mon", "Craftmon/attack" }
- print("Defining Cmon Directorys to install")
- CmonDirectorys = { "Blastoise", "Bulbasaur", "Charizard", "Charmander", "Charmeleon", "Creeper", "Ivysaur", "MissingNo", "Squirtle", "Venusaur", "Wartortle" }
- attackfiles = { "Bite", "BugBite", "BugBuzz", "DragonRage", "Ember", "FireBlast", "Flamethrower", "Growl", "Gust", "Harder", "HydroPump", "Psychic", "RazorLeaf", "Scratch", "Slash", "StringShot", "Synthesis", "Tackel", "TailWhip", "TakeDown", "VineWhip", "WaterGun", "WaterPulse", "WingAttack"}
- print("Defining Game files to install")
- mainGame = { "Cmon", "Craftmon/battlebackground.nfp" }
- i = 1
- while directorys[i] do
- print("Creating directory:" .. directorys[i])
- setdir(directorys[i])
- i=i+1
- end
- i = 1
- while mainGame[i] do
- print("Downloading File:" .. mainGame[i])
- downloadfile(mainGame[i])
- i=i+1
- end
- i = 1
- while CmonDirectorys[i] do
- print("Downloading Cmon:" .. CmonDirectorys[i])
- setdir("Craftmon/mon/" .. CmonDirectorys[i])
- downloadfile("Craftmon/mon/" .. CmonDirectorys[i] .. "/front.nfp")
- downloadfile("Craftmon/mon/" .. CmonDirectorys[i] .. "/back.nfp")
- downloadfile("Craftmon/mon/" .. CmonDirectorys[i] .. "/Stats")
- i=i+1
- end
- i = 1
- while attackfiles[i] do
- print("Downloading Cmon:" .. attackfiles[i])
- downloadfile("Craftmon/attack/" .. attackfiles[i])
- i=i+1
- end
- print("Rebooting")
- shell.run("reboot")
- end
- else
- print("TrinaryAtom code detects this is a older version and installation will not start.") -- This will trigger if on a Stone Computer of the latest version
- end
Advertisement
Add Comment
Please, Sign In to add comment