How to block already used names?

Hello, so I’m very new to Choicescript, but am learning a lot from this forum and trial and error, but I’ve run into a small issue that I could really use some help with.

So I’ve made a classic input_text Name ordeal but I’m kind of having trouble with warning about certain options.

Like, I want the players to be warned whenever they’ve input a name that’s already in use for a character.

I’ve tried using *if statements but have gotten nowhere so far- any advice would be super helpful

My code is pretty basic so far:

#None of these names.
    *input_text Name

But I have also tried:

#None of these names.
    *label input_name
    *input_text Name
    *if (input_text Name = "Deacon") = true
      *set input_text Name invalid
      *goto input_name
#None of these names.
    *label input_name
    *input_text Name
    *if (Name = "Deacon")
      Oops, that name is already in use, are you sure you want to proceed with it?
        #Select new name.
          *goto input_name
        #Proceed anyway.

This should work.


Thank you so much! That works perfectly :smile:

I’ve sort of run into another problem, what should I do if I’ve got multiple names I don’t want to be chosen?

I did:

*if (First = "Deacon") or (First = "Asher")

And that worked!

Buuuut it provides the issue that I get an error if I have more than 1 ‘or’.

I still have more than just those two names that I want to warn a reader of and doubling up *if statements doesn’t seem to work either (unless I’m just doing that wrong).

Any advise on that?

*if (((First = "Deacon") or (First = "Asher")) or ((First = "Lila") or (First = "Heather")))

This should work you need to add brackets to prevent the error.


Thank you once again! That worked great.

1 Like

This topic was automatically closed 24 hours after the last reply. If you want to reopen your WiP, contact the moderators.