Modify the default "Results.Scorepercent" variable?

Hello!

I have tried to read a few threads but too tecch saavy for me..

I have built several quizzes using the SL templates interactions and the final result score slide...

When showing the score of the participant in percet, I wish it would show only entire two figures and not the xx,xx%

(show 77% if 76.88% for instance, or 50% if 50,22%..)

Is this possible to modify the calculation function here?

Thanks for any help

J.

4 Replies
Ashley Terwilliger

Hi Julie,

There isn't a feature to make Storyline "round up" the percents, although it's something I know a few users have submitted a feature request for.  In regards to the threads you've mentioned reading, the work arounds do involve some additional set up and if youre having difficulty with one of those methods you may wan to reply in that thread to see if anyone is able to assist you. 

Alexandros Anoyatis

It is not exactly straightforward, but here's one way you can achieve this :

A) Copy the value of Results.ScorePercent to another numeric variable (say Results).
B) Trigger the execution of a JS trigger when value of 'Results' changes.
C) Inside the JS trigger use GetVar to get the value of 'Results', then use Math.round (see here), then SetVar the same variable.
D) On your Results slide, be sure to display 'Results' instead of 'Results.ScorePercent'

There are other ways, but this will probably be enough for now.

Hope this helps,
Alex

Bob Mongiovi

Thanks Alexandros, that worked for me.  

Here's what I did for anyone that wants to know:

  • Created a new variable called 'results'
  • on my results slide, I created two triggers
    • first trigger is this:


      and here's the script:

      **note that the third line, I used Math.floor, which rounds down.  If you use Math.ceil, it will round up.  And if you use Math.round, it will round it either up or down depending on the number.
    • Second trigger is this:
  • Then, in the text field for your score, I replaced '%Results.ScorePercent%" with "%results%"

That's it!  Just remember your triggers are layered in the order as seen above.  And also, you will not be able to see this in Storyline preview as it does not process javascript, and also won't be able to see it work if you launch the story.html file locally on your computer. You'll need to upload it to a server and view it there to see it work.