Explore the community Forums Lectora LMS Integration LMSSetValue Error Reply To: LMSSetValue Error

#429048 Score: 0
Profile photo of Tim K
Tim K
friend finder
junior moderator
wise owl
curious george
Group Member
354 pts

I’m not sure this function is the reason. It’s run when a page is loaded. When executed for the first time, i.e. when the course is launched, “startDate” is equal to 0.

If it’s not equal to 0 “if ( startDate != 0 )” the course calculates the difference between the startDate (the date the window has been opened) and the currentDate. The result is the time the window is open in milliseconds. The function “convertTotalMills()” brings the milliseconds into the format the LMS requires “hh:mm:ss.tenths” and saves the result in the variable “formattedTime” .

If startDate is equal to 0 (else), i.e. if the window has just been opened, it sets the formattedTime directly to “00:00:00.0”. The error occurs when the course tries to MySetValue( “cmi.core.session_time”, formattedTime)

But I don’t think it is related to the time formatting or time measure. The error says, “My attempt to set the LMS’ session time variable to the value of “formattedTime” fails, because the connection to the LMS is “Not initialized”. Or as Scorm.com formulates it: “The attempt to change the session time variable comes before the call to LMSInitialize.” which means the same: No connection to the LMS.

If something was wrong with the variable or its value, it should be a different error, e.g. “Incorrect Data Type”

Did you publish with “Prompt the user to navigate to the last viewed page”? If yes, the same error should occur:

LMS: LMSSetValue Error:cmi.core.lesson_location to [“welcome.html”]Not initialized