Games

Passing over Storyline Game data to your LMS

A question that has come up a lot lately is “How do I get the score from the new eLearning Brothers Storyline games to my LMS”. Storyline by default only passes over data to the LMS if it is a quiz or if it is a survey page. Since the games are more complex then either of those two options we needed to go another route for those that wanted to pass over data from a game to the LMS.

The route that we had to go done was to send the data through a Javascript trigger. We have released new versions of our Storyline games as of March 28th, 2013 that have a “Execute Javascript” trigger on the results page with this custom Javascript. By default the code is turned off, in order for you to use this you need to uncomment out the code that passes the score to the LMS.

The reason why the code is commented out or “turned off” is because SCORM only allows one quiz score per course or module, so this means if you have a game in a course and a couple pages later in that course you have a quiz you cannot get both of those scores sent to the LMS. If you have both set to track it will only pass over the score from the interaction taken last which ever one that may be (game or quiz). But if your game is going to be your quiz we want the ability for someone to report that to the LMS.

Within the “Execute Javascript” trigger we add the following code:

/*get LMS API*/
//var lmsAPI = parent;

/*set score; the first number is the score. The second is the max score and third min score*/
//lmsAPI.SetScore(100, 100, 0);

/*set status; possible values: “completed”, ”incomplete”, “failed”, “passed”*/
//SetStatus(“completed”)

This will pass over 100% as the quiz score. In order to grab a variable from the course you need to add another line of code and then access the variable in place of the first 100 in SetScore(100,100,0). Here is what the new code should look like:

/*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(“variableName”), 100, 0);

/*set status; possible values: ”completed”,”incomplete”, “failed”, “passed”*/
//SetStatus(“completed”)

If you type the code in like it is you will notice it still doesn’t work. You need to uncomment out the code. Uncomment means to remove the “//” in front of the lines of code you want to run. So removing those in this section of code should give you code looking like this now:

/*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(“zCardStacklQuestionsAnsweredCorrect”), 100, 0);

/*set status; possible values: ”completed”,”incomplete”, “failed”, “passed”*/
SetStatus(“completed”)

This will make now run your code just fine and when inside the LMS it will pass over the score.

Watch the video below to see this in action: