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 you have one.
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".
Yes. The execute Javascript is exactly like every other trigger, with a "what", "when", and optionally "conditions" component. The only difference is that it also has a "javascript" component, where you paste the script.
For it to work, SL has to have both "NumericEntry" and RoundedNum" variables. NumericEntry is a numeric variable, and RoundedNum is a text variable. They are both case sensitive, although there is nothing else essential about their names. You can change them, as long as the ones in the JS match the ones in SL.
5 Replies
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".
Thank you so much! Really appreciate your help.
Hi. I'm having this same problem and have no experience with Javascript. Would I put this script in the Execute Javascript trigger?
Thanks!
Yes. The execute Javascript is exactly like every other trigger, with a "what", "when", and optionally "conditions" component. The only difference is that it also has a "javascript" component, where you paste the script.
For it to work, SL has to have both "NumericEntry" and RoundedNum" variables. NumericEntry is a numeric variable, and RoundedNum is a text variable. They are both case sensitive, although there is nothing else essential about their names. You can change them, as long as the ones in the JS match the ones in SL.