Forum Discussion
Tracking the number of slides on LMS
Here's a quick example of what the JS trigger might look like.
var player=GetPlayer();
//grab the array so we can update it
var masteryArray=player.GetVar("masteryArray").split(",");
//grab the current slide number
var cIndex=player.GetVar("cSlide");
//set the array index of the current slide number to 1
masteryArray[Number(cIndex)]=1;
//push it back into storyline. Need to retain it so we can update it
var collapsedArray=masteryArray.toString();
player.SetVar("masteryArray",collapsedArray);
//calculate the sum of the array
for (var i = 0, sum = 0; i < masteryArray.length; sum += Number(masteryArray[i++]));
//grab the total number of slides and calculate the percentage complete
var tSlides=player.GetVar("tSlides");
var totalComplete=Math.round(sum/Number(tSlides)*100);
//submit to the LMS
var lmsAPI = parent;
lmsAPI.SetScore(totalComplete, 100, 0);
- CatWilliamson5 years agoCommunity Member
Hi Steve Flowers,
I know this is a really old post. I got a variation of this script to work, although not perfectly, in Articulate TempShare but I have not been able to get it to work in SCORMCloud or Moodle.
In Articulate TempShare, it will work unless a skip a slide when I will temporarily have a problem with the array index that I missed. It does not seem to insert a zero.
In SCORMCoud and Moodle, I can't get past the first slide. Any ideas? I would appreciate your assistance.
I'm using Storyline 3
Related Content
- 6 months ago
- 10 months ago