Forum Discussion
JavaScript and variable updating
I'm assuming you want the dial on slide B to match the value of the dial on slide A? If so I'd have a true/false trigger called something like "runscript". I would also rename all the dial variables to be something like Dial1001A, Dial1001B, Dial1002A, Dial1002B etc, and this code will do what you want:
var player = GetPlayer();
// List of variable pairs
var variablePairs = [
["Dial1001A", "Dial1001B"],
["Dial1002A", "Dial1002B"]
// Add more pairs here if needed
];
// Copy values
variablePairs.forEach(function(pair) {
var fromValue = player.GetVar(pair[0]);
player.SetVar(pair[1], fromValue);
});
and have that run on the base layer with the trigger Run Javascript when runscript chages. Then on the B Slides have 2 triggers, one to set runscript to true when the timeline starts on that slide and then one to change it back to false when timeline reaches 1 second.
There's probably a more elegant way to do it but this should do what you're asking. See the attached file to see it in action.