A Solution to rounding in Storyline – without using Javascript

Jun 06, 2013

Normal 0 false false false oNotPromoteQF /> EN-US X-NONE X-NONE

I found a way to round numbers in Storyline without using Javascript.  The challenge was to show whole percentage numbers from calculated decimal numbers (i.e. 33% for 1/3 and 67% for 2/3).  Searching through the forums, all I could find was Javascript solutions and suggestions to submit a feature request.  Not happy with either of these answers, I continued to play around.


I found that Storyline only holds 7 digits past the decimal place, and the 7th digit is rounded.  So to get a rounded decimal (percentage) as a whole number, divide by 100,000, and then multiply by 10,000,000. 

For example:

2 / 3 = 0.6666667  (rounded at the 7th position by Storyline)

0.6666667 / 100,000 = .000006666667 (which is rounded to 0.0000067)

0.0000067 * 10,000,000 = 67


Now we have our rounded 67% from 2/3


You should be able to apply this to any number you want to round.  Divide and then multiply by a multiple of 10 that is large enough to push the number you want to round to the 7th position past the decimal (i.e. 13,567 / 10,000,000,000 * 10,000,000,000 = 14,000)

99 Replies
Mitch Hayashi

Since this does not work in Storyline 360, I found a very easy way to implement a floor flunction in Storyline 360 without using Javascript.

EDIT: Corrected for edge cases and much simplified! Also attached an updated screenshot.

Corrected Steps:

  • Create one variable, floorScore, and initialize to 0

Results Slide triggers:

  1. Set floorScore equal to 100 when the timeline starts
  2. Subtract 1 from floorScore when floorScore changes if floorScore is greater than Results.ScorePercent

And that is it!


Old (incorrect) version below.

Edit 4/17/2019: I have removed the incorrect version to avoid confusion.

Lauren Fralick

Hi Mitch,

Thank you for providing this! When we implemented it we realized if we got a perfect score it was rounding down to 99%. I added a trigger between your step 1 and 2 triggers that says Set floorScore equal to Results.ScorePercent if Results.ScorePercent =100, and also added a condition on your step 3 trigger to say if floorScore does not equal 100. This solved the problem for us.

Michael Brown

Hi everyone

This discussion is great, some really useful info!

I'm still slightly stumped with this, I've created a SL using the triggers etc detailed above and it's got rid of the decimal places which is great, however it doesn't seem the maths is right.  If I score 4 out of 5 the results slide is telling me I score 79% rather than 80% and I can't work out whats not quite right.

I've attached the file, if anyone can help i'd be very grateful!



Mitch Hayashi

Hi Michael,

I noticed the same thing after playing around with my original triggers. I now use a much simpler method, though it just gives me a true floor function instead of rounding. I'm sure it can be adjusted to give true rounding, but a floor function works for what I need. Here is the updated version:

Initialize variable floorScore to 0

Slide Triggers on results slide:

Set floorScore = 100 when timeline starts

Subtract 1 from floorScore when floorScore changes if floorScore is > Results.ScorePercent


Then display floorScore on your results slide as the user's score. Attached is your project file with adjusted triggers.

Philippe JEANTY

I have tried the trick of Terry and Tom but the math are incorrect. I am not using this with a test score but with a slider, and I would like the slider to display just non decimal values but allow the slider to move in 10th of decimals.

Why is this the "rounded" value incorrect ?


Cynthia Klassen

I can't get this to work. I used the file that Tom uploaded four years ago (thanks Tom)! Wonder why this is still not automatic.

Anyway, maybe it's not working because I have two quizzes in my course so I have two results slides + I also have a final results slide.

I'm not as technically inclined as most of you so I just literally copy everything that Tom did in his file. I am unable to troubleshoot with my low skill levels. 

Can anyone help me figure out why it isn't working? Does it have to do with the fact that I have 3 results slides? Should one of the triggers be altered? Do I need 3 variables...1 for each results slide? Everything I've tried has failed.


Anna Gorshkova

Hello Mitch and Lauren,

Mitch, thank you for the great workaround!  Lauren, thank you for explaining how to keep the score at 100 vs. 99.

I am still trying to grasp how this workaround actually works...  Now I'm getting 1% if I get all of the answers wrong.  

Did anyone else run into this?  What additional trigger am I missing to prevent this from happening?

Thank you again! 


Anna Gorshkova

Hi Mitch,

Thank you so much for reaching out! I don't believe I had any triggers that were set to "greater or equal to."

I was able to navigate around the 1% by adding a trigger to set the floorScore equal to the value of the Results.Score.Percent if Results.ScorePercent was 0 (similar to the 100% trigger).  

I attached all of my slide triggers.  There shouldn't be any problem with adding this additional trigger, correct?

Thank you again.  

Mitch Hayashi

Hi Anna,

The reason you are getting 1% instead of 0% is because you are using the first version I posted which does not work for 0% for many reasons. The new trigger you added that sets floorScore to Results.ScorePercent if Results.ScorePercent equals 0 will work to correct this in most cases.

However, I recommend you use the corrected and simplified version in the edit to my original post that uses only one variable and two triggers.

David Price
Terry Arthur

I have a similar issue, but I am not using a results slide.  I am creating a conversion for Fahrenheit to Celsius and the math gives me a decimal.  I have tried to incorporate the math above, but it still gives me the decimal.  Does it only work on the results slide?

I am having a similar problem as Terry.  I am actually trying to show a percentage on a progress indicator and I need to strip off the 2 decimal places.  I don't need to round it (but it would be handy), I just dont want a progress indicator showing x.xx%

I have been right through this thread and tried the different solutions to no avail :(

Rinnai America


I finally had to use the Java solution and it works great…

2 days ago
Hello! This is what I use to round - add a trigger to execute this Java.
I usually have a variable that contains the answer, then I pass it to another variable, then run it though this script. NumberYearCalc is my answer that was passed. And RNDofNumberYearCalc is my new variable that the rounded number will be passed to.
var player = GetPlayer();
var JSRounded=Math.round(player.GetVar("NumberYearCalc"));

Thank you,

Terry Arthur
Training Development Analyst
Rinnai America Corporation
103 International Drive
Peachtree City, GA 30269
Phone: 800.621.9419 x4361
Direct Dial: 770.632.4361
Email: tarthur@rinnai.us
Web site: www.rinnai.us
Training site: www.trainingevents.rinnai.us
twitter: www.twitter.com/rinnai
facebook: www.facebook.com/rinnaiamerica
Rinnai America Corporation
Why Rinnai?