What's wrong with my javascript?

Jan 16, 2024

Happy New Year!
I was hoping someone could take a look at my JS and tell me what I am missing.
The script should look at a variable called Level_1 and read it's numeric value then, based on what that value is, jump to a specified slide in another scene.
Here is the script:
var player = GetPlayer();
var Level_1 = player.GetVar("Level_1");


if (Level_1 == 2) {
  player.TriggerJumpToSlide(6.2);
} else if (Level_1 == 3) {
  player.TriggerJumpToSlide(6.3);
} else if (Level_1 == 4) {
  player.TriggerJumpToSlide(6.4);
} else if (Level_1 == 5) {
  player.TriggerJumpToSlide(6.5);
} else if (Level_1 == 6) {
  player.TriggerJumpToSlide(6.6);
} else if (Level_1 == 7) {
  player.TriggerJumpToSlide(6.7);
} else if (Level_1 == 8) {
  player.TriggerJumpToSlide(6.8);
} else if (Level_1 == 9) {
  player.TriggerJumpToSlide(6.9);
} else if (Level_1 == 10) {
  player.TriggerJumpToSlide(6.10);

and so on...
I placed it in storyline to execute when the learned clicks a button.

Any help would be greatly appreciated. Thanks, Rob

2 Replies