14 Replies
Bruce Silver

Yes that was my starting point.  But it only works with text variables.  but I figured out how to add script to convert number variable to text variable, and then this works.  It's so simple, a shame SL doesn't just build it into the product.  99% of my variables are numbers, not text.

Jackson Hamner

Some javascript that should work

Number to Text

var player=GetPlayer();
var number = player.GetVar("numberVariable");
var text = number.toString();
player.SetVar("numberVariable", text);

Text to Number

var player=GetPlayer();
var text = player.GetVar("textVariable");
var number = integer.parse(text);
player.SetVar("textVariable", number);
Ashley Terwilliger

Hi Ruben,

This thread is a bit older so I'm not certain that folks are still subscribed. I'm not equipped to assist with Javascript, but you may want to share a bit more about what specifically you need to know in terms of next steps? You could also reach out to any users in this forum using the "contact me" button on their profile. 

Matthew Bibby

For anyone who comes across this thread in the future, note that you can capture number variables in the LMS by using a How Many survey slides rather than a Short Answer survey slide.

And Ruben, if you still need a hand with implementing this, see this tutorial for step by step instructions

Zsolt Olah

Mark,

If you can name the number variables as Num1, Num2, Num3, Num4, and Text1, Text2, Text3, etc (it doesn't matter what the name is as long as you distinguish them by a number increasing from 1-30).

Then you can use this:

var player=GetPlayer();

var number = 0;

var text = "";

for (var i = 1; i<=30; i++)

{

number = player.GetVar("Num"+i);
text = number.toString();
player.SetVar("Text"+i, text);

}

Sumrah Khalid

Hello Matthew

I have a slide where I need the students to choose 5 options. Each option has 5 marks assigned to it. Since I need to award marks on each response hence I couldn't rely on Pick Many. 

For this purpose, I created a numeric entry variable 'Score' and assigned a trigger(attached screenshot). This variable adds all the marks based on what option the student has chosen. 

Now I need to reflect the accumulated marks from this custom variable in my LMS, hence I followed the instructions you have outlined by using the How Many survey slide.  But the result is not awarded.

Please help! What am I doing wrong? 

Crystal Horn

Hi Sumrah!  I'm not sure if this is what you're going for, but check out this sample I created.  I had created a "survey" type quiz slide which customized feedback based on what the total score was in the survey.  I added Matthew's twist of using the How Many survey question type to enable the survey score to be reported to the LMS.

I'm attaching the file so you can see the setup.  Hoping that helps!