Forum Discussion

TimNeill's avatar
TimNeill
Community Member
10 years ago

Setting 'Results.ScorePoints' to equal my custom score variable

This subject seems to have been discussed for several years (which suggests a SL improvement is needed ...) but I would appreciate some guidance. 

I will have 10 custom quiz questions which can't be handled by standard SL quiz types (individual answer scoring and ticks/crosses within each question screen).

I accumulate the score from these 10 in a variable called 'My_Score'. I will also have another 30 questions which will use SL question templates and which accumulate their overall score in 'Results.ScorePoints'. 

So when I reach the Results slide I have my custom variable plus the SL 'Results.ScorePoints' variable. I can add them together with a Trigger to make 'My_Score' equal to the total score for all 40 questions but what is the simplest way to get this variable back into 'Results.ScorePoints' so that it appears in the Results and goes back to the SCORM LMS?

Could I force a 'dummy' quiz question with a data entry field to be set to the 'My_Score' value, so that the 'Results.ScorePoints' takes on this value?

 

JavaScript I don't believe can modify the 'Results.ScorePoints' variable?

Many thanks, Tim 

29 Replies

  • Dave and Ed,

    The SCORM functions are available in different scopes in Flash and html5. In a Flash course the SCORM api is in the parent of the javascript scope and in html5 it's in the same scope. You can accommodate it like this:

    var isFlash = typeof SCORM_APIFound === "undefined";
    var api = isFlash? parent : this;

    Then you can access the SCORM or Storyline functions like this:

    api.SCORM_SetScore(currentScorePercent, 100, 0)

    or

    api.SetScore(currentScorePercent, 100, 0) //Storyline function that does the same thing

    You can also set the status with the SCORM api or Storyline's versions of it like this:

    api.ResetStatus() //sets it to "incomplete"
    api.SetPassed() //sets it to "passed"
    api.SetReachedEnd()//sets it to "completed"
    api.SetFailed()//sets it to "failed"

  • Hello. I need to pass the value from a custom variable named "NotaFinal" to my LMS through SCORM. That variable is the sum of all the correct questions, that also are custom made.

    The value goes from 0 to 10.

    Could anyone share with me a Java Script code to pass this variable to the LMS?.

    Thank you very much.

     

    • GeorgeChamplin's avatar
      GeorgeChamplin
      Community Member

      Since the LMS is probably looking for a percentage score you can do this:

      First initialize the api (seen above in my reply to Dave and Ed).

      Then if the user got 8 of 10 correct, this will report 80%:

      api.SetScore(NotaFinal * 10, 100, 0)
      //this means (NotaFinal * 10, maxScore, minScore)

       

      This may also work, but I haven't tried it:

      api.SetScore(NotaFinal , 10, 0)

       

  • lynnsim's avatar
    lynnsim
    Community Member

    Hi, I wander anyone can help me take a look at my file created in Storyline 360. I have added multiple questions on a slide thus need to use custom score variable to add them up. The problem is when it come to the result slide I need to set the Results.ScorePoints to equal my custom score variable. The file will  be upload as SCORM to Blackboard and report as status: completed.

    I try to use the javascript from this discussion but it is not working. As I am a multimedia designer without any javascript background, I can only copy and paste without knowing where could be the problems.

    Will really appreciate if anyone could help me change the javascript to make it work.

  • I have used the custom score variable and wanted to set LMS status as complete on the basis of the user score. However, the completion status is being determined based on slides viewed. For example, If I have scored below 75% and attempted all the questions, the LMS status should be incomplete and failed, but it is reflecting as complete.

    I have used following js code on the last screen:

    var player=GetPlayer();
    var cScore=player.GetVar("FinalScore");

    var lmsAPI = parent;
    lmsAPI.SetScore(cScore, 100, 0);

    if (cScore>=75)
    {
    SetStatus("completed");
    }
    else
    {
    SetStatus("incomplete");
    }

    Please help me to sort out this problem ASAP as an important project delivery of mine depends on this.

  • Hi Tim, may I know how can I add 3 differents score points in the final result? Currently, I have 3 Sections of the assessment, and I would like to add all score points and get the percentages into final result. I really appreciate it if you could advise me on this. 

  • Hi, Abdul, and welcome to E-Learning Heroes! ✨

    Since this is an older discussion, Tim's solution might be different than what you're looking to do. 

    When you add a Results slide, you have the option to choose multiple draws or questions from different sections of your project, which would calculate a final score. 

    Windows 10 (1) 2021-06-16 at 11.16.13 AM

    Let me know if this helps!