Using JavaScript for Calculations
May 09, 2014
Hi everyone,
I've been using Storyline for a while, but have only recently started to use the JavaScript function. I'm trying to create a calculator to determine wind chill based on two variables: Air Temperature (airtemp) and Air Velocity (airvelocity).
The calculation itself is very complicated, so it probably wasn't a good first JavaScript project for me to take on! I think I've set up the code correctly - however, when triggering the JavaScript, nothing happens. There are no error messages or pop-ups either, so I am confused about what I'm doing wrong. At the moment, the airtemp variable is set to -10 and the airvelocity variable is set to 50.
The script I have so far is:
var player = GetPlayer();
var airtemp = player.GetVar("airtemp")
var airvelocity = player.GetVar("airvelocity")
var windchill = 13.12+0.6215*airtemp-11.37*Math.pow(airvelocity,0.16)+0.3955*airtemp*Math.pow(airvelocity,0.16);
player.SetVar("windchill", windchill);
Does this look right? Can anyone tell me where I'm going wrong?
Thanks,
Josh
Be the first to reply
This discussion is closed. You can start a new discussion or contact Articulate Support.