How do I make a form to calculate 2 or more variables

Get help using Construct 2

Post » Thu Aug 17, 2017 11:39 am

Hello all

I want to make a simple form where users enter 2 or more numbers (in different input text) and when they hit on calculate button the result is displayed as a text. In my understanding, you have to store the input in 2 variables as numbers and then put the formula to calculate those 2 variables and display the result. Can someone advise how to do this please?

Thank you
Regards
B
16
S
4
Posts: 34
Reputation: 1,016

Post » Thu Aug 17, 2017 12:35 pm

B
33
S
18
G
29
Posts: 2,493
Reputation: 21,450

Post » Thu Aug 17, 2017 12:57 pm

99Instances2Go wrote:Euro 7.5
plugin-mathparser_t188947


Hello

Thank you for your reply
Is this plugin can capture text from input text box and store it into a global variable or instance variable?

Regards
B
16
S
4
Posts: 34
Reputation: 1,016

Post » Thu Aug 17, 2017 3:06 pm

No, if that is all you need, then set the numerical global variable the to numerical translated contents of the textObject.

translate a string to a number you do with int(string); or ....

int(textObject.text)
B
33
S
18
G
29
Posts: 2,493
Reputation: 21,450

Post » Thu Aug 17, 2017 3:47 pm

99Instances2Go wrote:No, if that is all you need, then set the numerical global variable the to numerical translated contents of the textObject.

translate a string to a number you do with int(string); or ....

int(textObject.text)


Ok I you talking about something like that : Global number Variable1 = int(textObject.text)?

Let say for example I want to calculate a price with taxes
Variable1 = int(price.text)
Variable2 = float(taxes.text)

Can I get the result with another variable3 which will be variable3 = variable1*variable2?

If so, how to display variable3?
B
16
S
4
Posts: 34
Reputation: 1,016

Post » Thu Aug 17, 2017 5:11 pm

B
33
S
18
G
29
Posts: 2,493
Reputation: 21,450

Post » Sat Aug 19, 2017 4:03 pm

99Instances2Go wrote:https://www.scirra.com/manual/116/text


Thank you for the reference.
I did not find the result yet but I am going to continue the test

Regards
B
16
S
4
Posts: 34
Reputation: 1,016

Post » Sat Aug 19, 2017 5:08 pm

B
33
S
18
G
29
Posts: 2,493
Reputation: 21,450

Post » Tue Aug 22, 2017 2:51 am

99Instances2Go wrote:https://www.dropbox.com/s/86q9lfr0nmvgn8t/calculateSomething.capx?dl=0


Thank you so much.

That is exactly what I was looking for
B
16
S
4
Posts: 34
Reputation: 1,016


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 3 guests