If value is 'digit'?

Get help using Construct 2

Post » Wed Aug 15, 2012 3:12 pm

Hey!

Is it possible to check if a variable contains digits? If so; how can I do that? I'd like to create a event like this;

IF value contains digits
     Set text"You won cake!"


Thanks,
~ Thijs Thijsku2012-08-15 15:14:49
B
21
S
6
G
3
Posts: 64
Reputation: 2,924

Post » Wed Aug 15, 2012 4:32 pm

int(value) if its not just a number it should return 0 or some form of invalid I believe. Dont hold me to that tho lol
B
13
S
5
G
2
Posts: 306
Reputation: 3,262

Post » Wed Aug 15, 2012 4:43 pm

int(x) - convert x to integer

It doesn't check if it is or not and return a 1 or 2..

How about checking if int(x) = x, if it is, then it is an integer already.
B
36
S
10
G
6
Posts: 948
Reputation: 11,101

Post » Wed Aug 15, 2012 6:57 pm

[QUOTE=Rory] int(x) - convert x to integer

It doesn't check if it is or not and return a 1 or 2..

How about checking if int(x) = x, if it is, then it is an integer already.[/QUOTE]
That did the trick! Thanks for the replies! Thijsku2012-08-15 18:57:58
B
21
S
6
G
3
Posts: 64
Reputation: 2,924


Return to How do I....?

Who is online

Users browsing this forum: Callan S, getplay, Kagubro and 26 guests