Moodle & Storyline

Oct 08, 2014

Is there anyway i can pass the score of a quiz to Moodle LMS other than adding storyline's inbuilt result slide?

I have created a custom quiz with blank slides (without converting it into a free form quiz or graded quiz).Assigned a number variable GrandTotal to keep track of learners score.can i use this variable (grand total) to pass the score to Moodle LMS ?

I don't want to use inbuilt result slide.

i have also attached my story file.

51 Replies
Ashley Terwilliger-Pollard

Hi Melissa,

Sure - I just made a really quick example. If you take a look it's three slides, and the second slide is the short answer which I'm setting to the value of the previous text entry. 

To show how it's changing and being set, I included a variable reference on the final results slide so that you could see that it's being adjusted. 

Kevin Thorn

Hi Melissa,

I *think* know what you're trying to do. Remember, the "TextEntry1" variable was created by default when the Data Entry Text Entry object was inserted. 

If you're not having users enter any text, the challenge you're facing is wanting to combine two different variable types (number and text) - which we can't do.

What if you changed your cases variable to a text variable. When the user clicks, adjust that variable with a number value. Remember, a number variable can only hold numeric integers whereas a text variable can hold alphanumeric values and special characters.

Now, you can pass the value that was added to one text variable (user clicks) into the final text variable (pass to LMS).

Melissa Milloway

The reason I was doing it that way was because I was following this post: http://www.articulate.com/support/storyline/how-to-send-the-value-of-a-variable-to-an-lms

I was assuming that I could pass my number variable into the actual text box and then it would report that to the LMS, however I did not realize that I could not adjust a text variable to equal a numeric variable. 

Kevin Thorn

Right, that tutorial David Fair shows should work.

First, understanding how variables behave is key to less consumption of asprin and prevents over indulgence in alcohol beverages. :) One cna only pass a variable to another variable of the same type. Here's the preso I did last week at DevLearn - see #2 > http://www.slideshare.net/NuggetHead/articulate-storyline-fundamentals-of-variables

Now, for your setup create a text variable with a name of "varCase".

Insert the Survey Short Answer per David's Screenr and follow the steps. Notice how his selection of radio buttons adds a text value to his variable for the personality type chosen. Create a similar trigger for your buttons, but add (set) the respective number to your varCase variable.

The hard part is getting your brain to understand the differences between a Number variable vs. a numeric text value.

Hope this helps.

Melissa Milloway

That's an awesome deck. Thank you for sharing. 

I'm not using any buttons, will this work with shapes? I wish he had included the file with the tutorial. It's hard for me to understand without deconstructing something.

It would be great if there were a tutorial out there with a file that shows how to pass numeric variables to the LMS.

Steve Flowers

If you want to get super-tricky, you could do this in a single JavaScript trigger. This would record a new interaction with a custom label every time you hit the trigger event. In this case, it doesn't matter what your variable type is. Advantage here is it's pretty easy and doesn't rely on acrobatics in a question. Doesn't even require a question to trigger the interaction capture. Also lets you call the interaction whatever you want instead of the built-in ID.

var lmsAPI = parent;
var player=GetPlayer();
var customString=player.GetVar("myCustomSLVar");
var date = new Date();
//this calls the SCORM API to record a custom interaction
lmsAPI.SCORM_RecordInteraction("call-it-what-I-want-darnit",customString ,true ,"" ,"" ,"" ,"" ,"" ,date , "fill-in");

Melissa Milloway

Would it be this below if the variable I want to report is called "cases" ?

var lmsAPI = parent;
var player=GetPlayer();
var customString=player.GetVar("cases");
var date = new Date();
//this calls the SCORM API to record a custom interaction
lmsAPI.SCORM_RecordInteraction("cases",customString ,true ,"" ,"" ,"" ,"" ,"" ,date , "fill-in");

I'm not sure what the "fill-in" and all the "" ""  are? And then I would just add it to the main slide?

 

This is why I need to learn more about JS. LOL.

Steve Flowers

Yep. That would grab your "cases" variable contents. The blanks are unnecessary parameters for this use case. Those would need to be there to provide placeholders so the other stuff can go into the function. Fill-in tells the LMS it's a text entry interaction.

Here's the part of the data model with different types that shows the options. Storyline usually handles this automatically. In the code above, we're just hijacking the same function Storyline uses to submit interaction data to the LMS to do our bidding.

cmi.interactions.n.type (“true-false”, “choice”, “fill-in”, “long-fill-in”, “matching”, “performance”, “sequencing”, “likert”, “numeric” or “other”, RW) Which type of interaction is recorded
http://scorm.com/scorm-explained/technical-scorm/run-time/run-time-reference/

You'd trigger that on submission or after the entry has been made. Good to put on something that requires a click.

 

 

Steve Flowers

Here's the start of the function we're calling with lmsAPI.SCORM_RecordInteraction:

function SCORM_RecordInteraction(strID, strResponse, blnCorrect, strCorrectResponse, strDescription, intWeighting, intLatency, strLearningObjectiveID, dtmTime, scormInteractionType, strAlternateResponse, strAlternateCorrectResponse){

Since we only care about setting the ID string, response string, whether the response is correct or not (just works out better as true in my testing), date, and interaction type, the parameters in between blnCorrect and dtmTime are left blank with "". The parameters at the end don't matter. We just needed to leave spaces to make sure date and type are passed. LMS call will fail without those.

 

Melissa Milloway

Oh gosh, I have to add all of this that is bolded too? I just want it to pass the numeric varible "cases". :(

function SCORM_RecordInteraction(strID, strResponse, blnCorrect, strCorrectResponse, strDescription, intWeighting, intLatency, strLearningObjectiveID, dtmTime, scormInteractionType, strAlternateResponse, strAlternateCorrectResponse){

Steve Flowers

var lmsAPI = parent;
var player=GetPlayer();
var customString=player.GetVar("cases");
var date = new Date();
//this calls the SCORM API to record a custom interaction
lmsAPI.SCORM_RecordInteraction("cases",customString ,true ,"" ,"" ,"" ,"" ,"" ,date , "fill-in");

 

That right there will pass to the LMS an interaction with the name cases along with whatever is currently in your cases variable in Storyline. You could attach it to a button. Hit the button 5 times and the interaction will be recorded 5 times with a new interaction increment.

This discussion is closed. You can start a new discussion or contact Articulate Support.