# How do I: put a 'clamp' on two added numbers.

Get help using Construct 2

### » Fri Nov 28, 2014 9:31 pm

Hi guys.
As the title suggests, I'm trying to find a way to stop two added values from going over a certain limit within the formula. Something like:

a+b=(not to go over 100)

Is it possible?

I'm basically trying to add RGB values together to create RGB mixes using 'tint'. So if I add:
Red=100,0,0
Blue=0,0,100
I get magenta: 100,0,100.

Further down the line I envisage the numbers being mixed totalling more than 100!
B
7
Posts: 33
Reputation: 341

### » Fri Nov 28, 2014 9:39 pm

max(a, b [, c...]), min(a, b [, c...]) Calculate maximum or minimum of the given numbers. Any number of parameters can be used as long as there are at least two.

https://www.scirra.com/manual/126/system-expressions
B
71
S
22
G
281
Posts: 3,842
Reputation: 154,886

### » Fri Nov 28, 2014 10:09 pm

Yeah, I saw that while searching for a solution.
I'll be honest, I didn't understand it completely.

I realised, shortly after posting my question that my game plan probably wont work anyway.
Thinking out loud....
to blue-0,0,100
I get magenta.
Theres no other combinations left other than adding green to magenta, giving white.
All values will be 100 and the game technically over.

I wanted to keep combining coloures, creating many different ones!!

What can I do?
B
7
Posts: 33
Reputation: 341

### » Sat Nov 29, 2014 12:11 am

You've got a rang of 0 to 100 on each RGB channel, so there's plenty of colour options.
B
71
S
22
G
281
Posts: 3,842
Reputation: 154,886

### » Sat Nov 29, 2014 9:52 am

I was thinking the way I've coded it is wrong.
B
7
Posts: 33
Reputation: 341