Forum Discussion
Allow Free Navigation after Course Update
To solve the task, you will need JS. I have prepared a sample code that should work (but I cannot guarantee this, you need to test it in your LMS). You need to create a text variable called resultcourse. When the course starts (right at the beginning on the first slide), you should add a few triggers.
The first trigger - start the JS code when the slide's time begins and copy the code I added below. The second trigger (more likely several triggers) - when the variable courseupdate changes - you need to unlock the course menu (I don't know exactly how you lock and unlock navigation in the course) if the value of the variable resultcourse = completed.
I haven’t tested the code myself, so I cannot guarantee it will work, but this direction for finding a solution should definitely work.
var player = GetPlayer(); // Getting the Storyline Player object
// Function to find LMS API
function findLMSAPI(win) {
if (win.hasOwnProperty("GetStudentID")) return win; // If API is found, return
else if (win.parent == win) return null; // If this is the top level, return null
else return findLMSAPI(win.parent); // Otherwise, continue searching in the parent window
}
// Initializing LMS API
var lmsAPI = findLMSAPI(window);
if (lmsAPI) {
// Getting the course completion status
var completionStatus = lmsAPI.GetValue("cmi.completion_status"); // Requesting completion status
// Logging the status to the console
console.log("Course completion status:", completionStatus);
// Saving the status in the text variable resultcourse in Storyline
var result = (completionStatus === "completed") ? "Completed" : "Not Completed"; // Formatting the status
player.SetVariable("resultcourse", result); // Setting the variable value in Storyline
var currentCourseUpdate = player.GetVariable("courseupdate");
var newCourseUpdate = currentCourseUpdate + 1;
player.SetVariable("courseupdate", newCourseUpdate);
Related Content
- 7 months ago