Forum Discussion
Javascript for audio mute/unmute that previously worked is no longer working
Quick question: can i still use the code written downstairs?
I use an numeric entry input to set a number and let this run after that.
/*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("14543GameScore"), 100, 0);
/*set status; possible values: "completed","incomplete", "failed", "passed"*/
if (player.GetVar("14543GameScore")>= player.GetVar("14543PassingPercentage"))
{
SetStatus("passed");
}
else
{
SetStatus("failed");
}
Hi Hassan,
You might try this...
//Function for the LMS API
function findLMSAPI(win) {
if (win.hasOwnProperty("GetStudentID")) return win;
else if (win.parent == win) return null;
else return findLMSAPI(win.parent);
}
//get the LMS API
var lmsAPI = findLMSAPI(this);
/*
set score; the first number is the score
*/
lmsAPI.SetScore(player.GetVar("14543GameScore"), 100, 0);
/*
set status;
possible values: "completed","incomplete", "failed", "passed"
*/
if (player.GetVar("14543GameScore")>= player.GetVar("14543PassingPercentage"))
{
lmsAPI.SetStatus("passed");
}
else
{
lmsAPI.SetStatus("failed");
}
Kind regards,
Math