Accessing Results.ScorePercent through Javascript

May 21, 2018


I am a long time e-learning and javascript developer. I had previously built a quiz results animation for my client which showed what percentage of the quiz the learner got correct.

The information I needed from Storyline to create this animation was very simple. Just the score percent. This is available in Storyline as the Results.ScorePercent variable which is available inside the Trigger Wizard.

This animation worked in Storyline 2. Now that we have upgraded to Storyline 3 it does not.


The Storyline 3 Javascript help ( indicates that storyline variables should be available through the GetPlayer().GetVar() method.

However, when I try...


...I get null in return.

In Storyline 2 I used to be able to access this information via...

function getQuizData(){
var quizList = window.story.quizzes;
var firstQuiz = quizList [Object.keys(quizList)[0]];
return firstQuiz.variables;

var quizData = getQuizData();

var percentScore = Math.round(quizData.PercentScore) + "%;

...In Storyline 3 it seems that the 'story' window object has been moved inside an anonymous function, making it inaccessible.

I tried adding text fields to the stage displaying the Results.ScorePercent variable and then reading their text. But it seems as of Storyline 3 this text is generated inside a SVG canvas and is therefore, once again, inaccessible.

So my question is as below. 

  • Through Javascript is there any way to read the Results.ScorePercent variable?
  • Through Javascript is there any way to access the 'story' object any more?
7 Replies
Marcia Witt

Hi Tristan!

Did you ever happen find an answer to this?

I am also trying to get this variable via JavaScript as follows:

var theScore =(



The display works perfectly in the slide but I want to print the score on an external printCertificate.html page--name and date is working for me. All I get is "null" for this variable.

This should be easy based on the article above...




Tristan Ward

Hi Marcia,

I did actually find a work around for not being able to access the Results.ScorePercent variable. While  Results.ScorePercent is not accessible through the player.GetVar() function, user variables are.

So on the results slide I added two triggers which put the value of Results.ScorePercent and Results.PassPercent into two different user variables called percentScore and passPercent.

In the export I was able to access those variables with:


That said, I don't know if that will work for you though. If you're in am 'external printCertificate.html page' then the 'player' Javascript object should not be accessible there because it is part of the Storyline HTML page.


Marcia Witt

Hi Tristan,

This worked beautifully!!

Initially I tried file.html?print= to place the Results.ScorePercent in the
URL string to no effect. Then I tried to set Results.ScorePercent to
another user variable in a variety of ways and spots and got only a null
value. But adding Results.ScorePercent to percentScore when the timeline
starts worked perfectly.

And, fyi, it will output to an external html file using GetPlayer. And I
had to use the following syntax:

var player = GetPlayer () ;

var theScore =(

var urlstring = ("printCertificate.html?print=" + theScore);

Thanks so very very much!

Johnny O'Barr

Hello, I am trying to figure out how to create a course with branched content leading to two different quizzes. Once the user takes one of the quizzes, I would like the quiz results to show a percentage that matches only the questions the user took. For example, the first 5 slides lead to a 6th slide that asks the user to pick a path. They pick the path, complete an additional 5 slides and then answer 10 quiz questions. There are another 10 questions on the other path they will not answer. I would like the quiz results to say 100% if they passed all 10 questions on their path. Is this possible using javascript? I feel like what you have talked about in this thread sheds a little bit of light on what I'm trying to do, hence me posting this here when it might seem a bit unrelated. 

Mike Fox

Hi Johnny,

Did you ever find a solution?  I'm trying to do the exact same thing.  We're developing content for agriculture and construction equipment technicians on how to repair equipment and we have different brands.  So for example, we might have a lesson that teaches about a certain transmission that goes in multiple brands of equipment.  90% of the content is the same, but then we split the paths in the lesson for the material that is different.  We want to quiz them on the material that is different and be able to grade them based on the questions they were given (i.e. if they choose the one brand, they might have 5 questions in that path and they'll never see the 5 questions for the other brand).  Ultimately it all has to feed into one results slide.  I figured I could probably do this with Javascript, but haven't dug into it yet.

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