There are some helpful methods you can use to pass values back and forth between Storyline and JavaScript as well. These won't work in the iOS player version or HTML5 version. JavaScript support is limited in the HTML5 output.
//create a player object
var player=GetPlayer();
var value1=player.GetVar(“firstVariable”); //a Storyline variable
var value2=player.GetVar(“secondVariable”); //another Storyline variable
var combo=value1+” is “value2;
//Example “Brutus” and “Awake” becomes “Brutus is Awake”
player.SetVar(“combination”,combo); //send from the JS variable combo into the SL variable combination
6 Replies
Hi Ugur - and welcome to Heroes.
Can you please be a little more specific about what it is, exactly, that you are trying to do here?
What type of programming?
Do you mean programming in designing/building the course, or for the learners to do some programming when learning?
If we can understand what you are trying to do I am sure we can help.
Thanks
Bruce
Thank you Bruce.
I want to use Javascript in my project when i design/build a course.
For instance i want to insert popup messages, how can i do that?
Thanks.
Hi - and thanks.
You can execute Javascript by using a Trigger.
Select the "Javascript" option, (as below), and then create your programme.
Hope that helps!
Bruce
Thanks Bruce,
That was my question answer. Thank you for your hepls.
There are some helpful methods you can use to pass values back and forth between Storyline and JavaScript as well. These won't work in the iOS player version or HTML5 version. JavaScript support is limited in the HTML5 output.
//create a player object
var player=GetPlayer();
var value1=player.GetVar(“firstVariable”); //a Storyline variable
var value2=player.GetVar(“secondVariable”); //another Storyline variable
var combo=value1+” is “value2;
//Example “Brutus” and “Awake” becomes “Brutus is Awake”
player.SetVar(“combination”,combo); //send from the JS variable combo into the SL variable combination
Thank you Steve for this example.
Actually i have a different problem. This codes weren't working in my project.
Thanks.
This discussion is closed. You can start a new discussion or contact Articulate Support.