Forum Discussion
lmsAPI Functionality in HTML5 Output
Hi there.
Firstly, I'd just like to say thanks to everyone that's contributed to this thread, as it's helped me with a project I'm working on.
I'm a bit stuck with one thing though. I'm trying to report the following details to an LMS for a confidence based multiple choice assessment:
- The answers that the user selected.
- The user's final 'knowledge' score (based on how they answered the question).
- The user's final 'confidence' score (based on how confident they were about their answer).
- The user's final 'combined' score as a percentage (based on both their knowledge and confidence).
- Whether they passed or failed (based on the final 'combined' score).
I've got the answers for each question being reported by using Storyline's built-in multiple choice quiz slides. I've also got the 'knowledge' and 'confidence' scores being reported by using hidden 'How many' survey slides. The final percentage score is being reported using bits of different Javascript code that I've found in this thread. The bit I'm stuck on is the 'Passed/failed' reporting.
I think it's currently taking the passed/failed status from the built-in Results.ScorePoints variable, which is the same as the 'Knowledge' score, as it's just based on whether the answers were right or wrong. This isn't taking the confidence score into account.
I've tried using the Javascript code recommended in this thread, but it doesn't seem to be overwriting it. I need to have the tracking based on the quiz result slide, as otherwise the answers aren't passed to the LMS. Is there any way to make the Javascript code overwrite the passed/failed status?
Here's the code I'm using. I'm a complete novice when it comes to coding, so it's possible the mistake being made is in here somewhere:
var p = GetPlayer();
var passingScore = "14";
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);
var cs = p.GetVar("finalscore");
var currentScorePercent = p.GetVar("finalscore_percent");
var ns = 2;
var currentScorePercent = Math.round(cs / ns * 10);
p.SetVar("finalscore_percent", currentScorePercent );
lmsAPI.SetScore(currentScorePercent, 100, 0);
if (player.GetVar("finalscore")>= passingScore)
{
SetStatus("passed");
} else {
SetStatus("failed");
}
The status is set to be reported as 'Passed/Failed' in Storyline, although I've tried pretty much every option and none of them are working correctly.
I want the status to show as failed if the 'combined' score percentage is less than 70%, or if the 'combined' score is less than 14.
I've tried a few different things in the code, but was wondering if someone with more coding knowledge would be able to see something obvious that I'm not seeing. Or if what I'm trying to achieve is just not possible when the tracking is based on the quiz results slide.
Thanks.