Forum Discussion
Sort numbered variables
// Get the values of the 8 variables and put them in an array
var variables = [ player.GetVar("Variable1"),
player.GetVar("Variable2"),
player.GetVar("Variable3"),
player.GetVar("Variable4"),
player.GetVar("Variable5"),
player.GetVar("Variable6"),
player.GetVar("Variable7"),
player.GetVar("Variable8") ];
// Sort the array in descending order and get the top three values
var topThree = variables.sort((a, b) => b - a).slice(0, 3);
// Set the top three values back to Articulate variables if needed
player.SetVar("Top1", topThree[0]);
player.SetVar("Top2", topThree[1]);
player.SetVar("Top3", topThree[2]);
JS Script could be your helping hand.
Thank you, I was thinking JS may be the answer but I don't know much about it so I will give this a go and see what happens. Thank you