How do I use math inside of a variable set function?

Get help using Construct 2

Post » Thu Dec 17, 2015 2:48 am

not sure how to go about typing this:

Code: Select all
(GlobalNumberN - CountIDLimitMax) > 0 ? (GlobalNumberN + CountIDLimitMax) > CountIDLimitMax ? CountIDLimitMax + GlobalNumberN


giving me some error about expecting a " : " for comparison or something. I had made a Min and Max value but I wanted to see if I could do it without having to declare a Min variable (which is easy and works).
B
5
S
1
Posts: 68
Reputation: 515

Post » Thu Dec 17, 2015 6:12 pm

The ? character is the beginning of a conditional operator. It's an if, then statement. It is used like this:

condition ? result if condition is true : result if condition is false

Your statement says:
IF (GlobalNumberN - CountIDLimitMax) > 0 then
IF (GlobalNumberN + CountIDLimitMax) > CountIDLimitMax then
CountIDLimitMax + GlobalNumberN

but it is missing bolth ELSE statements which are started by the : symbol.

What exactly are you trying to do with this statement?
B
38
S
12
G
11
Posts: 331
Reputation: 7,712


Return to How do I....?

Who is online

Users browsing this forum: skrotar and 10 guests