Number variable round to 0 when restart project online

Jul 07, 2016

Hi there,

I have a very big project with lot of questions. At the end, i have a little JS script who add values depend of answers. Like if learner answer A, i add 0.1, B +0.2, C +0.3...
It work pretty fine, i found the good value in my LMS's database. i print the var in browser console with a fine player.GetVar("ans_A"). And is really fine, it print 0.8 (for exemple).
Great. I quit the project in the browser.
And re-open it. Because learner must do the same test few weeks after the first time. And my console print 0 instead of 0.8. So all my answers are lost. In fact, he trunc all var. 0.8 became 0, 0.2 became 0, 3.4 became 3...

In storyline, i saved my vars in a number type. So is storyline trunc variable when rebooting a project ?

Thanks for helping.

3 Replies
riesseg -

How, it's bad. Start with Javascript in storyline is very powerfull and permit a lot o things !

Well, in waiting some answers, i think about my problem and i contourn. In fact, on my calculation slide, i add a new string var and i SetVat("myVar", ansA+";"+ansB+";"+ansC). So i have in myVAr a string like "0.8;0.5;0.9".
After that, in my begenning slide, i split it and can have the right value and not this bad trunc vars.

Et Voila. Problem Solved. (and more, more, more simple that go pick up result in my LMS database)

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