I declare the variable completionCode in the variable screens as 0 and it displays as 0. Cant get the JS to update the variable to use one of the indexs in codearray. .
var player = GetPlayer(); var codeArray=[62312,12636,54623,74624,12537,73754,46577,42467,13945,89562]; completionCode=codeArray[Math.round(Math.random()*(codeArray.length-1))]; player.SetVar("completionCode",completionCode);
var player = GetPlayer(); var codeArray=[62312,12636,54623,74624,12537,73754,46577,42467,13945,89562]; completionCode=codeArray[Math.round(Math.random()*(codeArray.length-1))]; player.SetVar("completionCode",completionCode);
Thanks worked perfectly. We are relatively new to storyline so I have to learn the functions and calls I can make directly to storyline. Is there list of those somewhere?
4 Replies
Hi William,
This code works for me:
var player = GetPlayer();
var codeArray=[62312,12636,54623,74624,12537,73754,46577,42467,13945,89562];
completionCode=codeArray[Math.round(Math.random()*(codeArray.length-1))];
player.SetVar("completionCode",completionCode);
A simple .story file is attached.
Thanks worked perfectly. We are relatively new to storyline so I have to learn the functions and calls I can make directly to storyline. Is there list of those somewhere?
There are three calls you can make: GetPlayer, player.GetVar and player.SetVar.
Here's a link to an Articulate support page on the subject.
This discussion is closed. You can start a new discussion or contact Articulate Support.