Forum Discussion
Exponential Operator for Adjusting Variable
2 basic errors in your script you could have found yourself when using the browser console to test when publishing.
Publish for Web, open it up and open the Console. F12 or CTRL+Shift+I
You will notice the error... exeJavascript - player is not defined.
That points to an error in somewhere in your script you call the Storyline player, but donot declare it.
As Storyline triggers all have their own scope...you need to make sure you have access to the player in every trigger. Global scope can be achieved but thats for another time.
So add this in your trigger:var player = GetPlayer();
After this change publishing again...you will notice it will not work.
And you have another error.
This one...
In fact a similar error as before, but now indicating that the variable N is not defined.
Checking your code you immediately notice that there is a variable 'N' but it is not called.
Instead in your script you call variable 'n'.
Do take good care that in Javascript a single character can make a big difference. When calling variables all names need to be exactly the same.
Make a habit of using a consequent way of naming your variables and calling them.
I use Camelcase coding. Meaning a variable is always written like this. mygoodVariable
Or use always CAPITALS or only undercast. Whatever works for you...but keep it consistent.
And use the console to check your code.
So changing your code to this...and all works.var N=player.GetVar("N");
Thank you very much, Math!
Very useful and appreciated feedback!
Related Content
- 3 months ago
- 4 months ago