Failed status not reported to Moodle

May 14, 2020

Hello!

I have created a small game in Storyline 3 (version: 3.9). I have used Javascript in the last slide to send the score and status to Moodle LMS( version: 3.8.2+).

The score is recorded properly, but the status is always set to Passed.

 

Here is the JS code:

var player = GetPlayer();
//Get LMS API
function findLMSAPI(win) {
if (win.hasOwnProperty("GetStudentID")) return win;
else if (win.parent == win) return null;
else return findLMSAPI(win.parent);
}

var lmsAPI = findLMSAPI(this);

lmsAPI.SetScore(player.GetVar("Score"), 100, 0);
if (player.GetVar("Score")>= 50)
{
SetStatus("passed");
} else {
SetStatus("failed");
}

 

I have also tried changing the code. It's still the same.

No matter what I change during publish, it cannot updated the correct status to Failed. It always sets the status to Passed.

I have used the following settings:

 

I have changed the LMS Reporting settings to different combinations, but it wouldn't work.

 

Any help will be appreciated.

Thanks

11 Replies
Sourish Bose

 I even created a simple, new 2 blank slides with the javascript to test it if there was any issue with the game. But it's the same thing. I guess the syntax is not correct in this part -

if (player.GetVar("Score")>= 50)
{
SetStatus("passed");
} else {
SetStatus("failed");
}

The score is getting passed to the LMS or Scorm cloud.

 

Sourish Bose

Also, I tried with this JS code:

/*Get player to reference*/

var player = GetPlayer();

/*get LMS API*/

function findLMSAPI(win) {
if (win.hasOwnProperty("GetStudentID")) return win;
else if (win.parent == win) return null;
else return findLMSAPI(win.parent);
}

var lmsAPI = findLMSAPI(this);

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

lmsAPI.SetScore(player.GetVar("score"), 100, 0);

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

if (player.GetVar("score")>= player.GetVar("passingpercentage"))
{
SetStatus("passed");
}

else
{
SetStatus("failed");
}

Sourish Bose

Okay. Do you mean that there should be one extra slide which will be hidden and not included in Track using slides viewed?

I tested with Storyline 2 using this JS and it worked fine. It sent a failed status if the score was less.

So, I guess something has changed in Storyline 3.

/*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("score"), 100, 0);

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

if (player.GetVar("score")>= player.GetVar("passingpercentage"))
{
SetStatus("passed");
}

else
{
SetStatus("failed");
}

Sourish Bose

 I got the solution from this post. It's at the end.

https://community.articulate.com/discussions/articulate-storyline/scorm-send-completed-status-to-moodle-lms

SCORM 1.2:

//get LMS API
var lmsAPI = parent;
//set score; the first number is the score
lmsAPI.SetScore(90, 100, 0);
//set status; possible values: "completed","incomplete", "failed", "passed"
//set status; possible values: "completed","passed", "icomplete", "failed"
SCORM_CallLMSSetValue("cmi.core.lesson_status", "complete");

 

SCORM 2004:

//get LMS API
var lmsAPI = parent;
//set score; the first number is the score
lmsAPI.SetScore(90, 100, 0);
//set status; possible values: "completed","incomplete", "failed", "passed"
SCORM2004_CallSetValue("cmi.completion_status", "completed");
SCORM2004_CallSetValue("cmi.success_status", "passed");

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