Hi All,
sorry for a very stoopid newb question here.
I have this script that will simply calculate the percentage.
somehow it just doesn’t work I always get a 0. The only time it will work is if the dividend is equal the divisor.
I tried addition, subtraction and multiplication and works just fine, tried playing with the parenthesis too.
Just can’t get the division though.
Here’s the script
var pointsEarned = 0;
var wrongAnswer = 0;
var rating = 0.0;
var pointsEarnedResultGUI : GUIText;
var wrongAnwserResultGUI : GUIText;
function Update ()
{
if(pointsEarned != 0)
{
rating = ((pointsEarned / 195)* (100));
guiText.text = rating.ToString() +("%");
}
}
Thanks,
Ray