Author Topic: My script breaks BL... ;-;  (Read 822 times)

My script:
Code: [Select]
$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));
^}
}

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...
« Last Edit: October 09, 2010, 02:46:45 PM by Pew446 »

Probably need a findFirstFile() and better to use a while() loop on the output of findNextFile().
Code: [Select]
%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);
}

Probably need a findFirstFile() and better to use a while() loop on the output of findNextFile().
Code: [Select]
%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);
}

Findfirstfile. Of course. Thank you soo much. :)

Alright, so I found the script doesn't even enter the while loop. Any help?

Code: [Select]
%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));

Code: [Select]
%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));

Thanks. :)