Forum Discussion
RebeccaBazzle-5
3 years agoCommunity Member
Calculator with 3 decimal places
Hi Everyone,
What is the best way to add a calculator to a Storyline file that will calculate to the third decimal place? Any help would be greatly appreciated. Happy to purchase a template if y...
WaltHamilton
Super Hero
The only way to do it right now is to use javascript to calculate and set the number to three places. Then send it back to SL into a text variable.
Here's a script that should take a SL numeric variable named "NumericEntry", round it to 3 decimal places, and send it back to a SL text variable named "RoundedNum".
var player = GetPlayer();
var numValue = player.GetVar("NumericEntry");
var JSRoundedNum = numValue.toFixed(3);
player.SetVar("RoundedNum",JSRoundedNum);
You need to create the SL variables first.
AprilDrennan-f8
2 years agoCommunity Member
Hi. I'm having this same problem and have no experience with Javascript. Would I put this script in the Execute Javascript trigger?
Thanks!