@d-healey said in expansionInstallCallback inside a for loop:
Don't use var unless you have to. Use reg for your counter.
Yeh I'll probably have to start namespacing soon, was trying to avoid it but I'm all out of regs :)
Got it working (so far):
var num_expansions_to_install;
var expansionInstallIndex = 1;
function expansionInstallCallback(obj)
{
if(obj.Status == 2 && isDefined(obj.Expansion))
{
if (expansionInstallIndex >= num_expansions_to_install)
{
expansionInstallIndex = 1;
Engine.showMessageBox("Installation Complete", "Library installation successful, please restart NEAT Player.", 0);
}
else
expansionInstallIndex++;
}
}
//Single
if (dir.isDirectory())
{
num_expansions_to_install = 1;
expansionInstallIndex = 1;
expHandler.installExpansionFromPackage(nest.hr, dir);
}
//Batch
if (dir.isDirectory())
{
num_expansions_to_install = hrList.length;
expansionInstallIndex = 1;
for (i=0; i<hrList.length; i++)
{
expHandler.installExpansionFromPackage(hrList[i], dir);
}
}
It's a bit clunky but it does the job, cheers!