check global text

Get help using Construct 2

Post » Mon Mar 25, 2013 11:26 pm

i have a global text called name that is set to "nul" when the player enters their name in a TextBox the global text is set to what the player typed. Next to the TextBox i have a button. what i want to achieve is when the button is pressed the player goes to the next layout, but if they have not entered their name a message pops up telling the player to enter their name.

I know how to do everything apart from how do I compare the values of the value of the global text, eg. if name="nul" and name<>"nul" I have tried useing the system option to compare values, but cant figure out to use it to compare values of a global text, I have tried name.text and text.name etc but nothing seems to work
B
10
S
4
G
3
Posts: 53
Reputation: 2,613

Post » Tue Mar 26, 2013 12:59 pm

first of all - set type of global variable 'Name' to Text, by default it's a Number (just in case :)) then on event Button on click you should make 2 subevents - textbox is empty or it's not. if empty - show message, if not - set textbox.text to global 'Name' and go to 2nd layout. hope it will help!
B
21
S
4
Posts: 29
Reputation: 1,253

Post » Tue Mar 26, 2013 2:07 pm

Thanks, works great. I think I wa trying to make it more complicated than it actually is.   
B
10
S
4
G
3
Posts: 53
Reputation: 2,613


Return to How do I....?

Who is online

Users browsing this forum: Yahoo [Bot] and 2 guests