Forum Discussion
I Want to Send the Value of a Project Variable to an LMS as the Score
You sure can. First, set up communication with the Storyline Player by retrieving its handle.
var player = GetPlayer();
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);
SetScore() requires 3 arguments to work: the learner's score, the maximum score, and the minimum score. Before we can send it, we need to retrieve the learner's score (contained in a variable you created) from the course.
var lmsScore = player.GetVar("learnerScore");
Now we can send that back to the LMS.
lmsAPI.SetScore(lmsScore, 100, 0);
If you also want to tell the LMS if the learner has passed or not, you can send the course status at the same time, based on the score. For example, if the passing score is 80:
if (lmsScore >= 80) { SetStatus("passed"); } else { SetStatus("failed");}
Related Content
- 12 months ago