Forum Discussion

PaulGolightly's avatar
PaulGolightly
Community Member
5 hours ago

JavaScript not working at all?

Hi everyone, a couple years ago I created a simulation of an internal product, and in trying to update the simulation, a JavaScript routine stopped working that had allowed Storyline to evaluate whether the user had inputted a certain string within the user's input.

After spending a lot of time troubleshooting the issue, I can't prove to myself that JavaScript is working at all within this project. I've simplified it down to these two lines just to change a variable from False to True:

var player = GetPlayer();
player.SetVar("Eval_UsedCaseNumber","True");

These lines are currently attached to a trigger that runs at the beginning of the timeline in my third slide. I've tried the same lines with different triggers, I changed the double quote marks in the code to single quote marks, I changed the variable from Boolean to text, and no matter what I do the JavaScript lines still don't seem to update the variable (as I can see from my debug page).

The two-year-old version is still working fine in Review.

I'm at wit's end. What am I doing wrong?

  • Nedim's avatar
    Nedim
    Community Member

    Try this:

    var player = GetPlayer();
    player.SetVar("Eval_UsedCaseNumber", true);

    This should properly update the boolean variable. Other than that, your code syntax looks good if you're setting a text value for the text variable. Additionally, check the console logs in your developer tools. You should see an error message or some indication if your code is not functioning as intended. If possible, please upload your sample project here so that someone can take a closer look.