Because I want to check this feature I worked out an example to learn from it and I want to share here what I learned with attached examples I explain in this post.
//get LMS API
var lmsAPI = parent;
//set score; the first number is the score
lmsAPI.SetScore(100, 100, 0);
//set status; possible values: "completed","incomplete", "failed", "passed"
Use a free https://cloud.scorm.com account to test this through until it works flawless and pass the score and status correctly. For example, the code I found did not pass the status until I put a ; at the end of the last line as in the example above.
First simple example
First I defined an empty result slide:
It might work without, but at least it will define the masteryscore correctly in the LMSmanifest file. Maybe someone can confirm the need.
Second example: work with Chapters
Now I understood I worked on the question:
For example, in each mandatory chapter you can set a true/false variable, for example "chapter1Complete=true when the learner visits a specific page in this chapter. In attached example I used a common Storyline tab template to make it a bit easier for testing. Visiting each tab set's a variable for example Complete1=true etc. My exercise is to make tab 1, 2 and 5 mandatory for completion.
To pass the score I used the button from the first example.
The user get's a visual clue that each tab is visited. When you design chapters you also must design something that the user know it's completed by a visual clue. In the TAB display it's done by states. When visitied, the state of the tab changes and display a checkmark.
Pass the complete score when tab 1, 2 and 5 are visited
I do not want that a learner pass the score when not all mandatory tabs have been viewed. Then the LMS gets a score (failed) and if you for example set in the LMS that you may do a limited number of tries, this can go wrong.
To make it visually clear, the state of the button changes when the mandatory tabs (1, 2, 5) are visited. You can do this by checking if all the variables Complete1, Complete2 and Complete5 are all set to true. However, in this case it's a bit easier to set the button on complete when the states of the tabs 1, 2 and 5 have been changed. Either way, both will work.
example 1: Pass the score to the LMS manually: click a button to pass a specific score
example 2: view tab 1, 2 and 5 to be able to complete the course