Hi there.
I wrote a function to take a certain number away from 100 and then divide by another number, eg:
(100-4.598)/.0125
Now my problem is, MC (or jscript?) can't seem to handle taking a decimal off 100, it just rounds the decimal up and produces a whole number. I have the value I'm taking off 100 stored as a variable and my function is written as such;
function GXPCounter(g2n)
{
var g2n = world.GetVariable("g2n");
world.SetVariable("g2n2", parseInt(100-(world.GetVariable("g2n"))));
world.Note("Rounds for FM: " + parseInt((world.GetVariable("g2n2"))/.0125));
}
Can someone tell me what I'm doing wrong?
Cheers
-Siri
I wrote a function to take a certain number away from 100 and then divide by another number, eg:
(100-4.598)/.0125
Now my problem is, MC (or jscript?) can't seem to handle taking a decimal off 100, it just rounds the decimal up and produces a whole number. I have the value I'm taking off 100 stored as a variable and my function is written as such;
function GXPCounter(g2n)
{
var g2n = world.GetVariable("g2n");
world.SetVariable("g2n2", parseInt(100-(world.GetVariable("g2n"))));
world.Note("Rounds for FM: " + parseInt((world.GetVariable("g2n2"))/.0125));
}
Can someone tell me what I'm doing wrong?
Cheers
-Siri