# How do I increase costs by percentages

Get help using Construct 2

### » Fri Aug 08, 2014 4:19 am

I have a button set up that I want to increase it's cost each time it is clicked by maybe 5%. I've searched but can't find anything on it anywhere. Right now i have it set at a fixed cost and have 10 sub events to allow it to be clicked 10 times but I also want it to be clicked as many times as they have money to buy it. I'm not looking for someone to do everything for me, only point me in the direction needed. thanks
B
6
S
1
Posts: 36
Reputation: 452

### » Fri Aug 08, 2014 4:46 am

5% = multiply by .05

have a variable.
on click, up the variable by the percentage.
(variable = variable * 1.05)

use that variable to calculate the cost.
B
88
S
43
G
71
Posts: 601
Reputation: 43,669

### » Sat Aug 09, 2014 11:37 pm

What you wrote makes sense to me but trying to implement it isn't going well. I wrote System|variable name = 25=25*1.05. is that what i needed to do if i was trying to make \$25 increase by 5%?
You do not have the required permissions to view the files attached to this post.
B
6
S
1
Posts: 36
Reputation: 452

### » Sat Aug 09, 2014 11:53 pm

I don't see that anywhere in your capx, but if you set the variable to 25*1.05, then that variable is just set at 26.25.

if you want to add 5% each time a button is clicked, then you would
on clicked | set variable "whatever" = whatever * 1.05.

this will add 5 per cent to the current number in the variable "whatever".

I would suggest naming your different buttons to something relevant
and not naming your variable a number (doesn't make much sense, if the number is going to change)
B
88
S
43
G
71
Posts: 601
Reputation: 43,669

### » Sun Aug 10, 2014 2:38 am

ok I don't know how I got it working but it is. Now I need help getting the Numbers to round up to next highest so i don't have 27.358823 as my total money.Also is there a way to get the price to show up inside the button and update there? I haven't looked for these answers yet but you seem to know what you are doing and would save me time. thanks for the help so far too
B
6
S
1
Posts: 36
Reputation: 452

### » Sun Aug 10, 2014 2:48 am

I just pretend to know what I'm doing. I'd suggest looking for the answers. you'll learn a lot more that way.
Deanomyite wrote:ok I don't know how I got it working but it is.

This is not a good thing. heh.

round(blah blah blah)
will round things
floor(blah blah blah)
will round them down
ceil(blah blah blah)
will round them up

B
88
S
43
G
71
Posts: 601
Reputation: 43,669

### » Sun Aug 10, 2014 2:56 am

ok and since you posted that about round and the others i do recall reading about them now in the manual. It's just so much easier getting the answers like this because half the time I don't even know what it is I need to look up thanks again
B
6
S
1
Posts: 36
Reputation: 452