# A tough one :D

• Beginner
• Posts: 61
• Loc: ro

3+ Months Ago

I have a tiny fuc*** problem: (a newbie problem)
I have 2 input text fields(INPUT 1 and INPUT 2 in the pics). And I introuce in those text fields numbers. The problem is that I can't do any mathematical operation with the numbers. The numbers acts just like a simple text. In my example I tryied to sum them with this code
Code: [ Select ]
rezult = input1 + input2
(rezult,input1,input2 are the variable name of their text fields), and this is what I obtained:

and managed to put up a script, but it's not fancy at all and it doesn't work for numbers bigger that 9999.

Code: [ Select ]
on(release){
for(i=1;i<=10000000000000;i++)
{if(input1==i){
input1=i;break;
}}
for(p=1;p<=10000000000000;p++)
{if(input2==p){
input2=p;break;}}
rezult= input1+input2;}
1. on(release){
2.     for(i=1;i<=10000000000000;i++)
3.                 {if(input1==i){
4.                     input1=i;break;
5.                 }}
6.     for(p=1;p<=10000000000000;p++)
7.         {if(input2==p){
8.             input2=p;break;}}
9. rezult= input1+input2;}
and this is what I obtained(exactly what I want)

Can anyone tell me how to obtain the same rezult easier without using those for's....
Thnx

[/img]
• Posts: 202

3+ Months Ago

Code: [ Select ]
rezult = Number(input1) + Number(input2);

Heres the function I'm using above:

• Beginner
• Posts: 61
• Loc: ro

3+ Months Ago

So fu** easy.....Why isn't that Number(message) in the help function?
Thnx a lot....you just saved me from writing a dozen of for's...

I'm such a newbie...

## Post Information

• Total Posts in this topic: 3 posts
• Users browsing this forum: No registered users and 7 guests
• You cannot post new topics in this forum
• You cannot reply to topics in this forum
• You cannot edit your posts in this forum
• You cannot delete your posts in this forum
• You cannot post attachments in this forum