Forum Discussion
MuhammadHaseeb-
2 years agoCommunity Member
Import variable from SCROM to moodle LMS
I have made an e-learning course in articulate storyline 360, which is having a variable name score, that is updated on viewing each slide, so I want to get the value of the variable score and export it to Moodle LMS. I have the following javascript code but didn't work for me. Does anyone have a solution for this problem?
var lmsAPI = parent;
var player = GetPlayer();
var myScore = player.GetVar("LMS");
lmsAPI.SetScore(myScore,100,80);
- Jürgen_Schoene_Community Member
here is a more universal method to find the lms
https://community.articulate.com/discussions/articulate-storyline/lmsapi-setscore-is-not-working
try this
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);
console.log( "lmsAPI", lmsAPI );
var player = GetPlayer();
var myScore = player.GetVar("LMS");
console.log( "myScore", myScore );
lmsAPI.SetScore(myScore,100,80);with the two lines "console.log" you get debug info for the browser console -> F12
- MuhammadHaseeb-Community Member
thanks for commenting