How do I multiplicate?

Get help using Construct 2

Post » Sun Jul 24, 2016 8:56 pm

Message: MaxWissmann can only post plain text URLS until they have 500 rep. 1 URLS modified. Why?
Hey Guys,

I want to create a Pokemon Go Evolution Simulator. There for i must multiplicate 2 numbers, the multiplicator and a number that the user types in. My question is how can i multiplicat them and put it in the already build sentence.

https://www.dropbox.com/s/y19zqbpfoq7yfam/ad.capx?dl=0
B
6
Posts: 20
Reputation: 288

Post » Sun Jul 24, 2016 9:06 pm

Well the multiplication symbol in C2 is * so you just need to put that into the expression, e.g.

2 * Variable1

This will give you the result of Variable1 (which can be your user input) being multiplied by 2.
B
49
S
23
G
17
Posts: 291
Reputation: 12,407

Post » Sun Jul 24, 2016 11:31 pm

The instance variable Bulbausur in text is updated with Text.Bulbausur*200, as you ask it to do.

But, you do it on each tick. Wich leads to a infinity number real soon.

I suppose you meant event 3 to be a SUB-EVENT to event 2. Just drag 3 under 2.
I also suppose that you wanted to writte the multiplication outcom in the textfield, not in the the Bulbausur variable. So ... Text > set text > str(Text.Bulbausur*200)

Tip: you can translate the string of the input to a number with: int (CPBox.Text).
Now the calculation = int(CPBox.Text) * Text.Bulbausur
B
33
S
18
G
27
Posts: 2,435
Reputation: 20,334

Post » Sun Jul 24, 2016 11:43 pm

If you gooing to make an instance variable for each multiplicator for each character, thats gonna be a lot of events.

Suggestion, make a second list holding all the multiplicators in the same order as the characters.
If you name that second list 'Mult', then the calculation =

int(CPBox.Text) * int(Mult.ItemTextAt(List.SelectedIndex))

One line of code for any selection and any value input.
B
33
S
18
G
27
Posts: 2,435
Reputation: 20,334

Post » Mon Jul 25, 2016 12:11 am

Thx for the quick support!
B
6
Posts: 20
Reputation: 288

Post » Mon Jul 25, 2016 2:44 pm

If you like me to show you, then make a second list with all multiplicators, post that capx, and i will alter it.
B
33
S
18
G
27
Posts: 2,435
Reputation: 20,334

Post » Mon Jul 25, 2016 4:02 pm

99Instances2Go wrote:If you gooing to make an instance variable for each multiplicator for each character, thats gonna be a lot of events.

Suggestion, make a second list holding all the multiplicators in the same order as the characters.
If you name that second list 'Mult', then the calculation =

int(CPBox.Text) * int(Mult.ItemTextAt(List.SelectedIndex))

One line of code for any selection and any value input.


Do you know as well how I can round up the number? 1321.34 to 1321
B
6
Posts: 20
Reputation: 288

Post » Mon Jul 25, 2016 4:12 pm

Floor(number) rounds down (1321.34 or 1321.94 = 1321)
Round(number) rounds to nearest (1321.34 = 1321 and 1321.94 = 1322)
Ceil(number) rounds up (1321.34 or 1321.94 = 1322)
B
33
S
18
G
27
Posts: 2,435
Reputation: 20,334

Post » Mon Jul 25, 2016 4:54 pm

99Instances2Go wrote:Floor(number) rounds down (1321.34 or 1321.94 = 1321)
Round(number) rounds to nearest (1321.34 = 1321 and 1321.94 = 1322)
Ceil(number) rounds up (1321.34 or 1321.94 = 1322)


Where should i put this? And whats missing here "with around" str(CPNumber.Zubat*int (CPBox.Text)) "CP" I cant write that
B
6
Posts: 20
Reputation: 288

Post » Mon Jul 25, 2016 6:07 pm

Because it is probaly
str(CPNumber.Zubat*int (CPBox.Text)) & " CP"

Where you need the number rounded.
Example : str(floor(CPNumber.Zubat*int (CPBox.Text)))&" CP"
B
33
S
18
G
27
Posts: 2,435
Reputation: 20,334


Return to How do I....?

Who is online

Users browsing this forum: jaytrott86, Yahoo [Bot] and 6 guests