Forum Discussion
Complex formulas using variables?
I am working on some interactive scenarios for which a score would be calculated at the end based on many variables, including built-in ones like how many interactions were had.
For example, I want to calculate something like ((A+B)/C+(D-E)*2)/100 (where each letter here obviously represents a variable or built-in value) and display the resulting value in a text box as a "final score." How would I accomplish that?
In case others stumble upon this thread, the author asked a variation of the same question here: Show results of complex calculations involving multiple variables? | Articulate - Community
There, the reply marked as the solution referred to JavaScript.
Another reply included a file demonstrating that, in Storyline, calculations have to be performed trigger by trigger. I also replied with a link to my post: PRIMER: Trigger calculations in Storyline | Articulate - Community
Bottom line: PhilMayor​'s reply above contains both options for performing calculations.
4 Replies
- PhilMayorSuper Hero
Use a few triggers or write the expression in javascript
If you use triggers it maybe cleaner to put the calc on a layer and show it and then hide it the layer when you need the calc to be performed. - JudyNolletSuper Hero
In case others stumble upon this thread, the author asked a variation of the same question here: Show results of complex calculations involving multiple variables? | Articulate - Community
There, the reply marked as the solution referred to JavaScript.
Another reply included a file demonstrating that, in Storyline, calculations have to be performed trigger by trigger. I also replied with a link to my post: PRIMER: Trigger calculations in Storyline | Articulate - Community
Bottom line: PhilMayor​'s reply above contains both options for performing calculations.
- jveedubsCommunity Member
Thanks! For some reason, I wasn't seeing that the other thread (or this one?) had been posted, so I posted again. Sorry about that!
- JoeDeyCommunity Member
I read this thread with interest about an hour ago which prompted me to quickly write an example in JavaScript using my trusted AI companion. If it works for you keep it. If you improve it please share it back here.