Forum Discussion

GregMetzger's avatar
GregMetzger
Community Member
2 years ago

Help With JavaScript Please

Hi All- I'm trying to simply combine the information from multiple variables in Storyline into one variable using JavaScript. I don't have any experience with coding. I can't get this to work. Slide1, Slide2, Slide3, Slide4, Slide5 are all text along with Combined. They are set up in Storyline. Here is the JavaScript:

var player=GetPlayer();
var value01=player.GetVar("slide1");
var value02=player.GetVar("slide2");
var value03=player.GetVar("slide3");
var value04=player.GetVar("slide4");
var value05=player.GetVar("slide5");
var TotalString=value01 + value02 + value03 + Value04 + Value05;
player.SetVar("Combined", TotalString);

When I publish locally and test by launching story.html the Combined field is not updating. Any ideas or suggestions would be awesome. Thank you!

  • You should learn to use the console in the browser to pick up errors and save you time, you have a case issue with Value04 and Value05. 

    Check what the case is in storyline.

  • GregMetzger's avatar
    GregMetzger
    Community Member

    Reporting back to confirm that your suggestion was spot on and resolved the issue. Also to say thank you again for taking the time to help.

  • Glad it worked, check the console it would have pointed you in the right direction. It was so nearly there.