0 votes
by (790 points)

Currently, I have the following text box for the player to input passwords:

<<textbox "$password" "" "NOTE">>

(where the "NOTE" page displays various passages depending on the passwords entered.)

However, the text box is case-sensitive, and the password must be inputted exactly. Is there a way allow variations of capitalisation to be accepted as well?

1 Answer

+3 votes
by (68.6k points)
selected by
Best answer

Where and how you'd use it would depend on how you have things set up, but you can use the <String>.toLowerCase() method to force the player's input to all lowercase for comparison to your known values, which would be in all lowercase.

For example:

<<set $password to $password.toLowerCase()>>



by (44.7k points)

.toLower() is not a function.  I assume you meant .toLowerCase()

So the code should be:

<<set $password to $password.toLowerCase()>>


by (790 points)
Thank you both! Turns out the answer is the same as the one posted before (https://twinery.org/forum/discussion/8644/sugarcube-1-text-inputs-converting-to-lower-case). It didn't work for me at first because I placed the code in the wrong area. For others' reference, you're supposed to place the code on the destination page - in my case, it would have been the "NOTE" page.