Storyline Interactions

Aug 28, 2016

I have developed a test quiz to find out how to send interaction results to Moodle LMS. It is a totally custom quiz from blank slides without any Storyline's inbuilt quiz formats or result slide.

It will be in SCORM 1.2 format with tracking by number of slides, LMS reporting : Passed / Failed or Incomplete / Passed.

I have a JS trigger at the end of course to send the total score and status to the LMS which is working fine.

Only thing i want is :

Whenever a user selects an option (like a radio button in multiple choice) and submits the answer, i want to send the each interaction / quiz result (like score, user response, correct response, id) to Moodle just like it does with default quiz formats.

Is it possible through any Javascript trigger utilising existing Stroyline SCORM functions to manually send interaction data for each question ?

I have also attached the quiz which i have developed as a test.

i don't want to use SCORM 2004 because Moodle only allows 1 attempt in case of SCORM 2004 packages.

18 Replies
Abhishek Roy

i have found this code in the lms.js file in the lms output folder :

function RecordInteraction(arrArgs)
var bResult = true;

var strQuizId = arrArgs[0];
var strId = arrArgs[1];
// var strId = arrArgs[2]; // Quiz id
var strType = arrArgs[3];
var strCorrectResponse = arrArgs[4];
var strStudentResponse = arrArgs[5];
var nLatency = arrArgs[6];
var strResult = arrArgs[7];
var nPoints = arrArgs[8];
var strTime = arrArgs[9];
var strWeight = arrArgs[10];
var nQuestionNumber = arrArgs[11];
var strDescription = arrArgs[12];
var strLearningObjectiveId = arrArgs[13];
var bTracked = (arrArgs[14] == "true");
var bSurvey = (strResult.toLowerCase() == "neutral");

if (bTracked)
strLearningObjectiveId = strLearningObjectiveId.replace(/[ \t\r\n\v\f]/g, "_");

strResult = normalizeResult(strResult);

var strTemp = "";
strTemp += "Description: " + strDescription + "\n";
strTemp += "Time: " + strTime + "\n";
strTemp += "Id: " + strId + "\n";
strTemp += "Learning Objective Id: " + strLearningObjectiveId + "\n";
strTemp += "Type: " + strType + "\n";
strTemp += "Correct Response: " + strCorrectResponse + "\n";
strTemp += "Student Response: " + strStudentResponse + "\n";
strTemp += "Result: " + strResult + "\n";
strTemp += "Weight: " + strWeight + "\n";
strTemp += "Latency: " + parseInt(nLatency) + "\n";
strTemp += "Survey: " + bSurvey;

Abhishek Roy

and this one is found in the LMSAPI.js file :

eval ("this.RecordMultipleChoiceInteraction = " + strStandard + "_RecordMultipleChoiceInteraction");

eval ("this.SetObjectiveScore = " + strStandard + "_SetObjectiveScore");
eval ("this.SetObjectiveStatus = " + strStandard + "_SetObjectiveStatus");

eval ("this.SetObjectiveDescription = " + strStandard + "_SetObjectiveDescription");

eval ("this.GetInteractionType = " + strStandard + "_GetInteractionType");
eval ("this.GetInteractionTimestamp = " + strStandard + "_GetInteractionTimestamp");
eval ("this.GetInteractionCorrectResponses = " + strStandard + "_GetInteractionCorrectResponses");
eval ("this.GetInteractionWeighting = " + strStandard + "_GetInteractionWeighting");
eval ("this.GetInteractionLearnerResponses = " + strStandard + "_GetInteractionLearnerResponses");
eval ("this.GetInteractionResult = " + strStandard + "_GetInteractionResult");
eval ("this.GetInteractionLatency = " + strStandard + "_GetInteractionLatency");
eval ("this.GetInteractionDescription = " + strStandard + "_GetInteractionDescription");

Phil Mayor

Scorm 2004 should be avoided in Moodle it is not really compliant and I think development is not ongoing for this.

The problem you have is that Scorm 1.2 spec does not have a data model element for describing an interaction, you may be able to set the using javascript 

If you enable LMS Debug Mode in a standard quiz file, you can watch the quiz data flowing from the content to the LMS in real time, and this may help you to identify how those IDs are being established.

This may help this is for a standard quiz slide, for a custom quiz you will need to write the function yourself and ensure Storyline does not overwrite it.


Abhishek Roy

Thanks Phil. Much appreciated.

Till now i am able to send objective status for each slide / interaction / quiz through a JS trigger.

var player = GetPlayer();


lmsAPI.SetObjectiveScore(1, player.GetVar("score1"), 100, 0);

lmsAPI.SetObjectiveStatus(1, 1);

where 1 = passed, 2 = completed, 3 = failed for the Status

It passes these status to Moodle well.

But i need to send the interaction data also. atleast user response, correct response.

Is there any JS code for SL2 to pass the data manually to Moodle 3.0.2 ?

Yes, i have enabled API Activity Log in Moodle. In default SL quiz, a bunch of interaction data are sent to LMS as son as the user submits the quiz.

But how can i convert those data elements to a JS code wihich will work in SL ?

Phil Mayor

Not sure I have never tried to do it.

The is a sequential array, you will need to query the LMS to find the next available slot, and then use javascript to insert your question. That is about as much as I know. Looking at the debug data you can see how storyline would send the data, then really you need to look at the scorm model and craft your javascript.



Hi Ashley,

Thx for your feedback.

In fact, the problem was for free-format questions, SCORM did not return the results, but returned the selected button types, so I had to name the buttons by their answers to have a readable report. On the other hand, the answers of the noted questions, were produced by SCORM  correctly, So i just needed to display the text of questions. for this, i used the JS function on trigger "SCORM_RecordInteraction" but it does'nt replace the ID : "Scene2_Slide10_MultiChoice_0_0"

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