Preventing story-name input

So, basically what I’m trying to do is prevent the player from inputting the names of story characters as their character’s name. Currently, the only way I know how to do this is to write an insanely long *if statement that checks for every variation of the name that one could possibly make using capitals and lowercase letters, but obviously that would be a massive waste of time.

What I want to do is simply compare the first name variable to variables containing the forbidden names, and if there’s a match with any of them, the first name variable is reset and the player has to choose a different name. Something akin to this:

*label fn_in
*input_text fn

*if fn = n1
     You cannot use this name. Please enter another name
     *goto fn_in
~~ continues on through rest of names~~
*else
     *goto begin

But, obviously, the text strings are case sensitive, so something like this isn’t directly achievable. Is there a workaround to this? Or should I just let the player use whatever name they please and run the risk of potential confusion?

Can’t you change the inputted name (and whatever you’re comparing it to) to all caps and then do the comparison? It might help alleviate some unnecessary code that would try to look for any variations of capital and lower-case letters.

Perhaps. But it would probably require a second variable, right? Because otherwise, the correctfully-cased version of the name that the player entered wouldn’t be saved if I changed it to all caps to compare it.

*if "$!!{name}" = "JESSIE"
  Name is invalid.

I think that is what you’re looking for. (I don’t think there’s a more efficient way to do it off the top of my head.)

4 Likes

Oh, I suppose that makes it relatively easy, now that I think about it. Let me give that a shot real quick.

EDIT: It worked for me. Thanks!

1 Like

If you have multiple name inputs, making the check a subscene is an advisable idea.

2 Likes