Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Slasher on Mon 19/11/2012 09:21:43

Title: Textbox lowercase and capitols
Post by: Slasher on Mon 19/11/2012 09:21:43
I'm looking for a way to make a Textbox input accept both lowercase and capitols of the same word .

Can you help?

Thanks


Title: Re: Textbox lowercase and capitols
Post by: Gilbert on Mon 19/11/2012 09:32:16
Depends on how you are going to recognise the strings.
For example, you can just set the caseSensitive flag to false when you use the String.CompareTo() (http://www.adventuregamestudio.co.uk/manual/String.CompareTo.htm) function. You can even use String.UpperCase() (http://www.adventuregamestudio.co.uk/manual/String.UpperCase.htm) or String.LowerCase() (http://www.adventuregamestudio.co.uk/manual/String.LowerCase.htm) to convert the whole thing to a single case before doing comparisons.

If you are using the parser, well... AFAIK comparisons are always case insensitive.
Title: Re: Textbox lowercase and capitols
Post by: Slasher on Mon 19/11/2012 12:19:05
Hi Iceboty V7000a,

At the moment for the correct answer I have 'if' as Uppercase and 'else if' as Lowercase and it works, as well as an 'else' for anything other then correct answer.

cheers



Title: Re: Textbox lowercase and capitols
Post by: Gilbert on Mon 19/11/2012 13:28:07
Actually I don't quite get what you are after, but if you write this:
Code (AGS) Select
if (tbBox.Text.CompareTo("meow")==0){ blah bla bla }
then it should work for entries like meow, MEOW and even Meow or mEoW.
Title: Re: Textbox lowercase and capitols
Post by: Slasher on Mon 19/11/2012 14:10:01
Cheers Iceboty V7000a

I'll give that a whirl  (nod)

EDIT: Works a treat.

Cheers Iceboty V7000a

slasher