One variable with multiple attributes (I want an input check where multiple answers are correct) [SOLVED]
Posted: Mon May 17, 2021 9:32 am
I lack the programming vocabulary so sorry if the title sounds confusing, but the idea is basically this:
I ask for a password. I give them the correct answer. Later they have to put in the answer.
My dilemma is now this:
People might use like 15 ways to write the password in regard to upper and lower case and I just want one neat line of options and have the game check that one line.
Something that looks like this:
This specific one doesn't work.
I looked up if you can make Renpy case-insensitive and the answer seems to be no, so I need to specify all the different variations of this answer somehow.
I tried to look here and on google for an answer, but almost all replies are about character names or stuff where the answers are NOT essentially identical (like, if you type in jokes, you get a different reaction which is not what I want. There is only right or wrong). I assume maybe there is a thread out there with my answer, but I have no idea what the words to find it are.
But I DO assume that there is probably a way to assign multiple answers to a condition/string/variable/whatever those are called.
I KNOW that I could just do this and be "done" with it, but ugh, it looks so...horrible and frankly, it looks unnecessarily complicated.
Like, sure, I do the latter if I am wrong and there is no alternative, but I want to hope there IS a way to just string all options together into one variable and do ONE If-check instead of 12.
I ask for a password. I give them the correct answer. Later they have to put in the answer.
My dilemma is now this:
People might use like 15 ways to write the password in regard to upper and lower case and I just want one neat line of options and have the game check that one line.
Something that looks like this:
Code: Select all
define e = Character("Eileen")
default password = ("crazy time", "Crazy Time", "CRAZY TIME", "Crazy time", "crazy Time")
label start:
$ code = renpy.input ("What time is it?")
if code == password:
jump right_code_white
else:
jump wrong_code_white
label right_code_white:
e "This was correct."
return
label wrong_code_white:
e "This was wrong."
jump start
I looked up if you can make Renpy case-insensitive and the answer seems to be no, so I need to specify all the different variations of this answer somehow.
I tried to look here and on google for an answer, but almost all replies are about character names or stuff where the answers are NOT essentially identical (like, if you type in jokes, you get a different reaction which is not what I want. There is only right or wrong). I assume maybe there is a thread out there with my answer, but I have no idea what the words to find it are.
But I DO assume that there is probably a way to assign multiple answers to a condition/string/variable/whatever those are called.
I KNOW that I could just do this and be "done" with it, but ugh, it looks so...horrible and frankly, it looks unnecessarily complicated.
Code: Select all
default password1 = "crazy time"
default password2 = "Crazy Time"
default password3 = "CRAZY TIME"
default password4 = "Crazy time"
default password5 = "crazy Time"
default password6 = "CrAzY tImE"
default password7 = "cRaZy TiMe"
label start:
$ code = renpy.input ("What time is it?")
if code == password1:
jump right_code_white
elif code == password2:
jump right_code_white
elif code == password3:
jump right_code_white
elif code == password4:
jump right_code_white
elif code == password5:
jump right_code_white
elif code == password6:
jump right_code_white
elif code == password7:
jump right_code_white
else:
jump wrong_code_white