Is there any way to disable Case sensitivity in our apps?

I am in the process of creating an MMORPG with gs, and twice now I have run into the case sensitivity issue. First of all when checking for a unique username, gs will not check for identical names with different cases. For example if I make an account named "John", my app will stop someone else trying to make their name "John" but wont stop someone from picking their name as "john".

Im using a string expression rule: if game.attribute is game.attribute2.

Now the more irritating issue is now when Im trying to create an online marketplace when searching for an item in the item database to buy. If the player is looking to buy a potion they must search "Potion" instead of what most people will search "potion" which will return no results.

Im using a string expression rule: if game.attribute contains game.attribute2.

Any way of fixing this or am I just going to have to inform players that the searches are cap sensitive?

Answers

  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,879

    You have several options.

    If you are making your own keyboard input routines, you can just covert all upper case letters to lower whenever a user strikes an upper case key.

    Or if you are comparing fully formed strings, you could convert each letter in the string to lower case.

    Or you can include in your test, both upper case and lower case versions. (If game.attribute contains game.attribute2 OR If game.attribute contains game.attribute3)

    There are probably more options, but these are the first three that come to mind.

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949

    For the account name, what I recommend is to store the name as typed ("John") and also store the converted lowercase string ("john"). When checking for existing names, convert the input to lowercase and check against the latter ("john"). That way, any variation will be caught (e.g. "JOHN", "john", "John", etc.).

    I would do the same for items. If you have an item called "Potion" then store another value for the lowercase version ("potion") and then convert the input to lowercase and search for it that way.

    So your tables might look something like this:

    John john
    Annie annie
    RONALD ronald
    terry terry

    Potion potion
    Sword sword
    Axe axe

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

Sign In or Register to comment.