Help with javascript - Passing score to LMS


I have developed a course having 2 quiz and a result slide. One of the quiz is not developed with the built in storyline quiz template, so I cannot link it up to the result slide. So I have added a new slide wherein I am displaying the score. I want to pass this score to LMS based on which LMS will decide whether pass or fail.

Attached is the .story file. The total score is calculated in the 'hazards' variable. This variable is also used in my Result slide to show whether pass/fail. On the result slide, I have added this javascript to pass the score to LMS and mark pass/fail in LMS accordingly. This code is not working in ScormCloud. Please tell me if anything is wrong with the code.


var player = GetPlayer();
var lmsAPI = parent;

lmsAPI.SetScore(player.GetVar(“hazards”), 70, 0);

SetStatus = "Passed";

SetStatus = "Failed";

8 Replies
Rick Blunt

Try this:

/*Get player to reference*/

var player = GetPlayer();

/*get LMS API*/

var lmsAPI = parent;

/*set score; the first number is the score*/

lmsAPI.SetScore(player.GetVar("hazards"), 100, 70);

/*set status; possible values:"completed","incomplete", "failed","passed"*/

if (player.GetVar("hazards")>=70)




Mayur Raskar

I want to to show customized score in LMS using java script, but in LMS my Score showing "unknown" result. Please help.

Here is the JavaScript i used for that:

var player = GetPlayer();

var lmsAPI = parent;

var myScore= player.GetVar("LMS");

lmsAPI.SetScore(myScore, 100, 80);



Attached is the LMS screenshot.