I am a noobie Javascripter, I am trying to make a javascript calculator for this game i play call ARENAscape. The trouble is when i try to add up the values it add wrong.
the lines that mistake is :
strT = str + ( (str / 3) * (str1 - 1) ) + weaStr;
str value is received from table:
str = document.form1.str.value;
weaStr = document.form1.weaAtt.value;
str1 value is calculated from:
if (str >= 7)
{ str1 += 1;
if (str >= 11)
{ str1 +=1;
if (str >= 14)
{ str1 +=1;
if (str >= 16)
{ str1 +=1;
if (str >= 18)
{ str1 +=1;
if (str >= 19)
{ str1 +=1; } } } } } }
Let's assume str = 80, the calculation in the middle is 0, and the weaStr = 40.
instead of adding 80 + 0 + 40 = 120, it add them to 80040 and messed up the calculation. anyone know how to fix it?
the lines that mistake is :
strT = str + ( (str / 3) * (str1 - 1) ) + weaStr;
str value is received from table:
str = document.form1.str.value;
weaStr = document.form1.weaAtt.value;
str1 value is calculated from:
if (str >= 7)
{ str1 += 1;
if (str >= 11)
{ str1 +=1;
if (str >= 14)
{ str1 +=1;
if (str >= 16)
{ str1 +=1;
if (str >= 18)
{ str1 +=1;
if (str >= 19)
{ str1 +=1; } } } } } }
Let's assume str = 80, the calculation in the middle is 0, and the weaStr = 40.
instead of adding 80 + 0 + 40 = 120, it add them to 80040 and messed up the calculation. anyone know how to fix it?
Comment