So, I've got it working minus trying to pass parameters to the function.
This code works fine, not passing any parameters, but defeats the purpose of making it a function.
function doFade()
{
//var channel = 1;
var iterations = 25;
var time = 5;
var currLevel = params.getValue("testFader", 0);
ogscript.debug("time: " + time + " | currLevel: " + currLevel);
var pauseTime = ((time * 1000)/ iterations);
ogscript.debug("Pause Time: " + pauseTime);
var levelPer = ((currLevel) / 25);
while (iterations >= 0)
{
currLevel = currLevel - levelPer;
ogscript.debug(currLevel);
params.setValue("testFader", 0, currLevel);
iterations--;
ogscript.pause(pauseTime);
}
}
ogscript.asyncExec(doFade, 0 );
This one doesn't seem to work. Is there a specific way multiple parameters need to be passed using the asyncExec function? I was assuming it would be an array, but I guess that's not the case?
function doFade(currVol, fadeTime)
{
//var channel = 1;
var iterations = 25;
var time = fadeTime;
var currLevel = currVol;
ogscript.debug("time: " + time + " | currLevel: " + currLevel);
var pauseTime = ((time * 1000)/ iterations);
ogscript.debug("Pause Time: " + pauseTime);
var levelPer = ((currLevel) / 25);
while (iterations >= 0)
{
currLevel = currLevel - levelPer;
ogscript.debug(currLevel);
params.setValue("testFader", 0, currLevel);
iterations--;
ogscript.pause(pauseTime);
}
}
ogscript.asyncExec(doFade, [ params.getValue("testFader", 0), 5 ] );
After messing around with it more for some reason when I try this it executes but ignores the pause function:
ogscript.asyncExec(doFade(100, 50));
#DashBoard