Hello I am trying to find a way to set all false variables in a course to true when another variable is triggered or when a timeline is started. How could this be done without having to manually find each variable?
Hi Tyler, you would need triggers for each out of the box. Or you can use something like this. You can trigger this when another variable changes. Replace the variable names in the setVars.
setVars("var1,var2,anothervar,mytruefalse");
function setVars(variables)
{
var player = GetPlayer();
var varsArray = variables.split(",");
varsArray.map(function (variable) { if (player.GetVar(variable) === false) player.SetVar(variable,true); });
1 Reply
Hi Tyler, you would need triggers for each out of the box. Or you can use something like this. You can trigger this when another variable changes. Replace the variable names in the setVars.
setVars("var1,var2,anothervar,mytruefalse");
function setVars(variables)
{
var player = GetPlayer();
var varsArray = variables.split(",");
varsArray.map(function (variable) { if (player.GetVar(variable) === false) player.SetVar(variable,true); });
}
This discussion is closed. You can start a new discussion or contact Articulate Support.