How do I check if a variable value is one of two values?

Get help using Construct 2

Post » Tue Nov 24, 2015 10:35 am

Hi

Is it possible to check if a variable is one of two values? For instance

Compare variable 'level' is in(1,2)

So this would return true of the value of 'level' is 1 or 2 and false for every other value.

I know this is possible via other ways but those ways would make me have to duplicate a lot of code - so I'm looking for a simple solution.

Kind regards
B
4
S
1
Posts: 6
Reputation: 262

Post » Tue Nov 24, 2015 10:58 am

Nvm, found the solution, leaving it here in case anyone needs the same

System test regex
String: str(level)
regex: "6|8"

returns true if level is 6 or 8
B
4
S
1
Posts: 6
Reputation: 262

Post » Tue Nov 24, 2015 11:00 am

Image
|=or...&=and
second value....0=False;...1=True
Image
B
62
S
23
G
7
Posts: 1,470
Reputation: 10,731

Post » Tue Nov 24, 2015 12:33 pm

That's indeed another option.

Thanks

totaly agree on your signature text btw
B
4
S
1
Posts: 6
Reputation: 262


Return to How do I....?

Who is online

Users browsing this forum: CrudeWall, RobertMKD, Yahoo [Bot] and 9 guests