Forum Discussion
lmsAPI Functionality in HTML5 Output
Mathew was kind enough to send me to this thread in order to resolve my problem. To summarize, some learners will go through the Storyline module and take a quiz using the basic Storyline quiz slides and results slide. They must get 80% or higher to get completion credit. However, some learners won't be required to view most of the content nor the quiz, so I created a button to take them to the last slide ("Thanks for taking this training"), where they can exit. However, as they're not taking the quiz, they won't get credit for completion. So I wanted to set it up so that upon clicking the button (or by whatever other means), and exiting the course, it will send a passing score to the LMS.
So I'm looking at the code and have a couple of questions (as you'll see, I'm a newbie to JavaScript -- I apologize in advance):
"...we need to define a passing score:
var passingScore = "100";
…in this example, the user would need to get a score of 100 or more to pass.”
In my case, the user needs nothing to pass except clicking the button, so I’m not sure what to put here? 0? I believe passingScore
would also be a custom variable I would need to create?
“Next, we will use Adam's code to find the lmsAPI. This will allow us to talk to the LMS:
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);”
Not sure which lines of code I would need from here....I don't need to get the Student ID as Adam did.
"Then we are going to get a score from Storyline (which in this example is stored in a variable called Your_Score_Variable*) and send that to the LMS:
lmsAPI.SetScore(player.GetVar("Your_Score_Variable"), 100, 0);
Next, we will see if the score we got from Storyline is greater than or equal to the passing score that we defined earlier:
if (player.GetVar("Your_Score_Variable")>= passingScore)"
I'm not sure what lines I need here, what variable I may need to create, and what the values should be.