Forum Discussion
MichaelBuzaki
12 years agoCommunity Member
Exponential Operator for Adjusting Variable
I am trying to add a calculation that would calculate the loan amount based on various variables. The equation is P * ((J) / (1-J)^n) . There is not an exponential operator and I do not see at the...
SteveFlowers
12 years agoCommunity Member
Using a JavaScript trigger you should be able to calculate using your equation and push the results back into another variable.
Create variables for J, P, n, and output.
Create a JavaScript trigger to grab the values entered in for J, P, n and return the equation results in output.
var player=GetPlayer();
//grab the equation inputs from SL
var J=player.GetVar("J");
var P=player.GetVar("P");
var n=player.GetVar("n");
//run the calculation and push into the SL variable called output
results=P*(J/(Math.pow((1-J), n)));
player.SetVar("output",results);
Related Content
- 3 months ago
- 4 months ago