Setting 'Results.ScorePoints' to equal my custom score variable

Sep 21, 2016

This subject seems to have been discussed for several years (which suggests a SL improvement is needed ...) but I would appreciate some guidance. 

I will have 10 custom quiz questions which can't be handled by standard SL quiz types (individual answer scoring and ticks/crosses within each question screen).

I accumulate the score from these 10 in a variable called 'My_Score'. I will also have another 30 questions which will use SL question templates and which accumulate their overall score in 'Results.ScorePoints'. 

So when I reach the Results slide I have my custom variable plus the SL 'Results.ScorePoints' variable. I can add them together with a Trigger to make 'My_Score' equal to the total score for all 40 questions but what is the simplest way to get this variable back into 'Results.ScorePoints' so that it appears in the Results and goes back to the SCORM LMS?

Could I force a 'dummy' quiz question with a data entry field to be set to the 'My_Score' value, so that the 'Results.ScorePoints' takes on this value?


JavaScript I don't believe can modify the 'Results.ScorePoints' variable?

Many thanks, Tim 

29 Replies
Ashley Terwilliger-Pollard

Hi Tim,

Thanks for reaching out here, and as you mentioned it's been discussed before as Storyline doesn't currently allow for you to edit the Results.ScorePoints using triggers as it's set based on the questions you've inserted and points associated with them. 

I'll defer to the community for their expertise and will be curious to see what you all come up with! 

Tim Neill

I'm hope the answer is going to be in setting the 'NumericEntry' variable to equal my custom 'My-Score' value (as if I had typed it in). I can do this OK. I have created a Numeric entry slide and this slide is included in the 'Results' slide but the 'Results.ScorePoin†s' still doesn't include the 'NumericEntry' value. Aaaaargh!


Tim Neill

Thanks Phil. When I get to the Results slide I will have two variables holding quiz question scores ('Results.ScorePoints' that is accumulated from the standard SL questions and 'My_Score' accumulated from my custom question slides with their individual marking, e.g.: score 0-10 on each screen). I need to combine these two into a single points value and then mark this as a Pass or Fail to the LMS.  

Dave Cox

You can use javascript to set your score in the LMS. To do this, you will need to keep track of the scores on your own.

Storyline lets you access Results.ScorePoints to display it on the screen, but you can't read or write it with javascript.

What you can do however, is add a trigger to the correct and incorrect feedback layers to collect that information into your own custom variable. Then you can use it however you want.

Tim Neill

Thanks Dave. I am collecting certain correctly-answered question points in my custom variable called 'My-Score'. Other questions use standard SL templates and they are accumulating in 'Results.ScorePoints'.

On the Results screen I am using a Trigger to Add the contents of 'Results.ScorePoints' to 'My-Score' (although I really wanted to do it the other way around). So I do end up with the correct total scored points from custom and standard questions. 

But which variables are returned via the LMS from the Results screen? The SCORM 1.2 Tracking screens just names the Results screen but not the variables. The other standard SL variables for ScorePercent, etc. would also not carry my custom data. Does SCORM send back ALL variables it finds on the Results screen?


Dave Cox

Storyline sends the score from the default score variables for the results slide that you have set up as the slide to report to the LMS. You can override that value with javascript, but to prevent Storyline from overwriting it, you have to be careful to send it after Storyline. I do this by placing it after the submit results trigger on the results slide.

This statement:


will send the value of the javascript variable My-Score, a max value of 100 and a min value to the LMS.

I hope that this helps.

Dave Cox

Well, sure, That statement only sends the score to the lms. 

To do this, I create 3 variables in the storyline player. CurrentScore, CurrentScorePercent, and PassScorePercent. 

Then I add a javascript trigger to each question slide on the correct answer layer to add 10 points to my variable CurrentScore. You need to keep track of this in your own variable, as Storyline does not make the internal score variable available to javascript.

Then I add this script in a javascript trigger that runs after the submit action on the results slide

var p = GetPlayer();

var cs = p.GetVar("CurrentScore");

var currentScorePercent = p.GetVar("CurrentScorePercent");

var passScorePercent = p.GetVar("PassScorePercent");

var ns = 10; // Number of Question Slides

var currentScorePercent = Math.round(cs / ns * 10);

p.SetVar("CurrentScorePercent", currentScorePercent );

console.log("Current Score Percent " + currentScorePercent);

lmsAPI.SCORM_SetScore(currentScorePercent, passScorePercent, 0);

console.log("Score Saved");

You will notice that I've added a couple of "console.log" statements. These are very useful when debugging your code. When you've added the scripts, publish your course for web or lms. Start your course in the browser. When it first starts, press F12 on your keyboard. This will open the debugging tools. (You may need to download these for firefox. Chrome's security settings may refuse to play the flash content with the new security settings if your are running from a local file.) With the debugger window open, select the console tab. The results of the console.log statement may be viewed in the console window. 

Since I'm sending a score percentage, I need to calculate the percent from the actual score. Set the var ns to the number of slide that you have.

I like to debug in Chrome, but with the new security settings, you need to run the module from an actual URL (HTTP//) not a file (file//) designation. I get around this by running it in localhost on my PC. This saves me from having to upload it to the LMS for each test. If you want to set up the localhost server, you will need to add a mime type for .mp4 media content, but once you do it works great for testing.

(I did this from memory, so you may need to check it for typos.)

I hope that this information helps.

Ed Crane

I've found that with 2 out of the 3 LMSs that I've uploaded my course to that uses Dave's Javascipt that the course does send the correct score, but it is apparently not enough for the LMS to consider the course to be completed. For example, I uploaded to SCORM Cloud, and achieved a score of 80%, which is the minimum to pass. SCORM Cloud showed that I got 80%, but also showed the completion as "incomplete" and the success as "unknown."

With our LMS for our internal users, it's showing as complete. 

In the reporting options, I have "Report status to LMS as:" set to Completed/Incomplete. Any ideas? 

Digital Choralia

I have worked around this by setting up a Pick One Freeform Question, where the correct question only appears if the custom Points variable is over the desired threshold, but it actually looks like a Submit answer button, which then leads to the Results page.

Of course, this only sends the LMS a binary information: have I reached or not reached the threshold.

If you wish a finer grain of tracking, you can also work with a Pick Many Freeform Question, and you have one different button per each points bracket, of course if your Results variable can range anywhere from 0 to 100, that would mean setting up 100 buttons - not the best!

Dylan Post

If anyone is having trouble with this still, I have used custom questions in the past and have handed the scores by creating null standard questions to respond to variable states. For example:

If I have a custom question, I have the interaction set it's custom variable (say Interaction_1) to whatever I need. (If it is a simple binary choice, it can be a true false variable, otherwise, a specific numeric value will do just fine.) Rinse and repeat for all custom questions. Then, just before going to the results slide, I create a series of multiple choice/true false questions that have point values that correspond with what I wanted my custom interactions to be. Using timeline start triggers and if/than statements, I have the slides "auto" answer based on the variable states. When the question is answered, I use another trigger to automatically advance to the next.

It's not the most elegant solution, but it plays within the boundaries of Storyline. You can even cover up the slides with a loading progression so the learner never sees the back end.

I will create a mock example and upload it later today. (Because I'm sure my description is confusing as all get-out.)

George Champlin

Dave and Ed,

The SCORM functions are available in different scopes in Flash and html5. In a Flash course the SCORM api is in the parent of the javascript scope and in html5 it's in the same scope. You can accommodate it like this:

var isFlash = typeof SCORM_APIFound === "undefined";
var api = isFlash? parent : this;

Then you can access the SCORM or Storyline functions like this:

api.SCORM_SetScore(currentScorePercent, 100, 0)


api.SetScore(currentScorePercent, 100, 0) //Storyline function that does the same thing

You can also set the status with the SCORM api or Storyline's versions of it like this:

api.ResetStatus() //sets it to "incomplete"
api.SetPassed() //sets it to "passed"
api.SetReachedEnd()//sets it to "completed"
api.SetFailed()//sets it to "failed"

Meca Contenidos

Hello. I need to pass the value from a custom variable named "NotaFinal" to my LMS through SCORM. That variable is the sum of all the correct questions, that also are custom made.

The value goes from 0 to 10.

Could anyone share with me a Java Script code to pass this variable to the LMS?.

Thank you very much.


George Champlin

Since the LMS is probably looking for a percentage score you can do this:

First initialize the api (seen above in my reply to Dave and Ed).

Then if the user got 8 of 10 correct, this will report 80%:

api.SetScore(NotaFinal * 10, 100, 0)
//this means (NotaFinal * 10, maxScore, minScore)


This may also work, but I haven't tried it:

api.SetScore(NotaFinal , 10, 0)