Forum Discussion
TerryMcDonald
12 years agoCommunity Member
A Solution to rounding in Storyline – without using Javascript
Normal
0
false
false
false
oNotPromoteQF />
EN-US
X-NONE
X-NONE
...
MichaelHinze
Community Member
See attahced a file that uses JS to round the input from a numeric entry.
SandyDutra
8 years agoCommunity Member
I tried applying this JavaScript and it doesn't seem to work. I have an answer that shows as (i.e.) 10.454240362 and I want it to round up to 10.45
How can I apply a variable/JavaScript to make this work?
Thanks
Sandy
- OwenHolt8 years agoSuper Hero
Sandy,
You would use something like the following:
var player = GetPlayer();
var num = player.GetVar("Your StoryLine Variable");
num = Math.round((num + 0.00001) * 100) / 100;
player.SetVar("Your StoryLine Variable", num);