| Blockland Forums > Modification Help |
| My script breaks BL... ;-; |
| (1/2) > >> |
| Pew446:
My script: --- Code: ---$filecount = getFileCount("Add-Ons/Client_Textures/Textures/*.png"); for(%i = 0; %i < $filecount; %i++){ ^%file = findNextFile("Add-Ons/Client_Textures/Textures/*.png"); ^if(!isFile("base/data/shapes/" @ fileName(%file))){ ^^fileCopy(%file, "base/data/shapes/" @ fileName(%file)); ^} } --- End code --- Makes Blockland's console loop at startup, and never stop. So the game never loads. Is it because I'm copying to base? Is it the for loop? ;-; Please help... |
| Uristqwerty:
Probably need a findFirstFile() and better to use a while() loop on the output of findNextFile(). --- Code: ---%pattern = "Add-Ons/Client_Textures/Textures/*.png"; %file = findFirstFile(%pattern); while(%file) { if(!isFile("base/data/shapes/" @ fileName(%file))) fileCopy(%file, "base/data/shapes/" @ fileName(%file)); %file = findNextFile(%pattern); } --- End code --- |
| Pew446:
--- Quote from: Uristqwerty on October 09, 2010, 03:29:16 PM ---Probably need a findFirstFile() and better to use a while() loop on the output of findNextFile(). --- Code: ---%pattern = "Add-Ons/Client_Textures/Textures/*.png"; %file = findFirstFile(%pattern); while(%file) { if(!isFile("base/data/shapes/" @ fileName(%file))) fileCopy(%file, "base/data/shapes/" @ fileName(%file)); %file = findNextFile(%pattern); } --- End code --- --- End quote --- Findfirstfile. Of course. Thank you soo much. :) |
| Pew446:
Alright, so I found the script doesn't even enter the while loop. Any help? |
| Kalphiter:
--- Code: ---%pattern = "Add-Ons/Client_Textures/Textures/*.png"; for(%file = findFirstFile(%pattern); %file !$= ""; %file = findNextFile(%pattern)) if(!isFile("base/data/shapes/" @ fileName(%file))) fileCopy(%file, "base/data/shapes/" @ fileName(%file)); --- End code --- |
| Navigation |
| Message Index |
| Next page |