What is Javascript syntax for storyline?

Jul 21, 2014

I would like to try using Javascript with my custom made buttons. Is there an example anywhere where this is used in Storyline? I can see where to add it. I am just wondering if we need to type the full syntax or if it is cut down. Like maybe just the action because the parameters are already there such as on click and the name of the button. Can anyone help?

2 Replies
Marco Faust

Javascript interaction with Storyline is very limited, but still quite useful.

Almost anything you want to do will start with this command

var player = GetPlayer();

The actual interaction with Storyline comes down to interactions with Storyline variables that you need to declare in storyline:

Getting a variable value out of Storyline into Javascript:

var jmyvar = player.GetVar("myvar");

Getting a variable from Javascript into Storyline:

player.SetVar("myvar",jmyvar);

What you do with the variable in Javascript and what the variable does in Storyline are wide open. Any valid Javascript functions work in the Javascript itself.

What is really missing is a DOM for the Storyline object itself. The ability to manipulate anything beyond the declared Storyline variables either doesn't exist, or is not generally knowable from the Storyline editor. I am hoping that future versions of Storyline have substantially more Javascript functionality.

This discussion is closed. You can start a new discussion or contact Articulate Support.