How to deny an *input_text answer

So let’s say I have a part where you type in a responce, an *input_text thing. Can I give an error message if someone types something specific? If so how would I go about doing this

*temp name
*input_text name
*if name = "Jessie"
  You cannot call yourself Jessie for whatever reason.

If you don’t care about capitalization in their answer, just use this *if instead (make sure your check is in all capitals too):

*if "$!!{name}" = "JESSIE"
  You cannot…
*label tryagain
*input_text answer

*if "$!!{answer}" = "DEM ONLY CORRECT ANSWER"
   You answered correctly
   *goto somewhere
*elseif "$!!{answer}" = "OBVIOUSLY NOT THE CRRECT ANSWER"
   Obviously, it isn't
   *goto tryagain
   *goto tryagain
1 Like

Thanks guys! This one had me stumped for a while

1 Like

Well, it’s basically as same as coding for the correct answer, but it’ll bring you back to the *input_text again instead.

And you might notice that we used "$!!{answer}" for the code example. You don’t have to do this exactly, but it’s a good habit to get into. ChoiceScript is case-sensitive, you see.

1 Like

Oh yea, and I built a thing to search and match strings a while back if you want to get real fancy:


That sounds a little too advanced for my tastes :sweat_smile:

1 Like