Check to see if text is "null"?

Get help using Construct 2

Post » Fri Feb 03, 2012 1:05 am

Hey all. I was struck by inspiration and have a neat game idea that I think I'll be able to make using the free version of C2 (I hope).

I've run into a bit of a snag though. At the start, the player needs to enter in their name. It is crucial that they enter a name of some kind, and not just leave the field blank.

How do I check to see the input of the textbox, and have the game give an error when the value is "null", or nothing?

Thanks.
B
10
S
2
G
5
Posts: 49
Reputation: 3,081

Post » Fri Feb 03, 2012 1:32 am

Check the value of Text (Text.text) and evaluate if "" (Blank).

Here is CAPX CAPXZetar2012-02-03 01:37:49
B
192
S
6
G
7
Posts: 213
Reputation: 10,178

Post » Fri Feb 03, 2012 1:40 am

[QUOTE=Zetar] Check the value of Text (Text.text) and evaluate if "" (Blank).[/QUOTE]
EDIT: Just saw the .CAPX file, thanks. Joshua2012-02-03 01:41:57
B
10
S
2
G
5
Posts: 49
Reputation: 3,081

Post » Fri Feb 03, 2012 1:41 am

Look at previous post again - I added CAPX.   You would want to set up a global variable that is triggered when text is entered into the Text Box. And not let them press the button until that variable is toggled on.
Zetar2012-02-03 01:44:10
B
192
S
6
G
7
Posts: 213
Reputation: 10,178

Post » Fri Feb 03, 2012 1:45 am

If whipped that capx up real fast. If you want I can redo it with a button and variable to show how. Or you could try and let me know...
B
192
S
6
G
7
Posts: 213
Reputation: 10,178

Post » Fri Feb 03, 2012 1:51 am

[QUOTE=Zetar] Look at previous post again - I added CAPX.   You would want to set up a global variable that is triggered when text is entered into the Text Box. And not let them press the button until that variable is toggled on.
[/QUOTE]
Good idea, I'll try that. I was actually able to find a work around, but your way is better, thanks.
B
10
S
2
G
5
Posts: 49
Reputation: 3,081

Post » Fri Feb 03, 2012 1:54 am

[QUOTE=Zetar] If whipped that capx up real fast. If you want I can redo it with a button and variable to show how. Or you could try and let me know... [/QUOTE]
I was finally able to figure it out. Thank you so much for your help.
B
10
S
2
G
5
Posts: 49
Reputation: 3,081

Post » Fri Feb 03, 2012 1:57 am

NO problem.
B
192
S
6
G
7
Posts: 213
Reputation: 10,178


Return to How do I....?

Who is online

Users browsing this forum: Lof and 4 guests