Code: Select all
$ correctcolors = "red" and "blue" and "green"
$ colorguess= renpy.input("What color was it?")
if colorguess== correctcolors :
jump easteregg
else:
jump guessagain
Code: Select all
$ correctcolors = "red" and "blue" and "green"
$ colorguess= renpy.input("What color was it?")
if colorguess== correctcolors :
jump easteregg
else:
jump guessagain
sonictoad wrote: ↑Thu Apr 23, 2020 6:51 pmI'm having a hard time with the correct conditional for this. So, I have an easter egg in the game where different things can happen based on how the user answers one question. It's written like this:
When I tested this, it only recognized "red", not any of the other inputs. What am I doing wrong?Code: Select all
$ correctcolors = "red" and "blue" and "green" $ colorguess= renpy.input("What color was it?") if colorguess== correctcolors : jump easteregg else: jump guessagain
Code: Select all
$ correctcolors = ("red", "blue", "green")
$ colorguess= renpy.input("What color was it?")
if colorguess in correctcolors :
jump easteregg
else:
jump guessagain
hell_oh_world wrote: ↑Thu Apr 23, 2020 10:17 pmsonictoad wrote: ↑Thu Apr 23, 2020 6:51 pmI'm having a hard time with the correct conditional for this. So, I have an easter egg in the game where different things can happen based on how the user answers one question. It's written like this:
When I tested this, it only recognized "red", not any of the other inputs. What am I doing wrong?Code: Select all
$ correctcolors = "red" and "blue" and "green" $ colorguess= renpy.input("What color was it?") if colorguess== correctcolors : jump easteregg else: jump guessagainCode: Select all
$ correctcolors = ("red", "blue", "green") $ colorguess= renpy.input("What color was it?") if colorguess in correctcolors : jump easteregg else: jump guessagain
What exactly are you trying to do? I just guessed that somehow you want to check whether the input is in the list of valid colors that can be guessed so that should work.sonictoad wrote: ↑Fri Apr 24, 2020 11:08 amTried that and it didn't work. Tried with both single quote (') and double quote (") in the parenthesis, also tried both == and "is", and in both cases it didn't recognize any input. With no parenthesis, it only recognizes the first string but not the others.
hell_oh_world wrote: ↑Thu Apr 23, 2020 10:17 pmsonictoad wrote: ↑Thu Apr 23, 2020 6:51 pmI'm having a hard time with the correct conditional for this. So, I have an easter egg in the game where different things can happen based on how the user answers one question. It's written like this:
When I tested this, it only recognized "red", not any of the other inputs. What am I doing wrong?Code: Select all
$ correctcolors = "red" and "blue" and "green" $ colorguess= renpy.input("What color was it?") if colorguess== correctcolors : jump easteregg else: jump guessagainCode: Select all
$ correctcolors = ("red", "blue", "green") $ colorguess= renpy.input("What color was it?") if colorguess in correctcolors : jump easteregg else: jump guessagain
Code: Select all
define colors = ("red", "blue", "green")
label start:
jump guess
label guess:
$ guessed_color = renpy.input("What do you think is the color?")
if guessed_color in colors: # the below code will run if the guessed color is in the defined colors, so if enter `red` this block will run, the color is case sensitive, it should be entered as how it was defined.
"Wow! You got it right!"
jump proceed
else:
"Oops! Wrong guess. Try again."
jump guess
label proceed:
pass
Users browsing this forum: mold.FF