Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
define e = Character("Eileen")
default Cheat_Money = False
default Money = 0
default Wellness = 0
default Cheat_Wellness = False
# The game starts here.
label start:
e "Today we are testing out cheats"
e "So please enter a cheat"
menu:
"Cheat Input":
$ renpy.input("Enter a cheat")
if renpy.input == "Add Money":
$ Money +=100
$ Cheat_Money = True
"You have entered the correct cheat for Money"
if Cheat_Money == True:
"Cheat was already entered before"
jump start
if renpy.input == "Wellness Up":
$ Wellness +=10
$ Cheat_Wellness = True
"You have entered the correct cheat for Wellness"
if Cheat_Wellness == True:
"Cheat was already entered before"
jump start
else:
"You did not enter a correct cheat phrase"
jump start
e "So did you enter any cheats correctly?"
return
Follow the code from top to bottom and you'll understand why it doesn't work. You are checking the input result first, and then checking Check_Money, you want it the other way around. Also, you may want to use "and", "or", "elif" in these conditions:
if renpy.input == "Add Money" or renpy.input == "Wellness Up":
if renpy.input == "Add Money" and Cheat_Money == False:
$ Money +=100
$ Cheat_Money = True
"You have entered the correct cheat for Money"
elif renpy.input == "Add Money" and Cheat_Money == True:
"Cheat was already entered before"
jump start
elif renpy.input == "Wellness Up" and Cheat_Wellness == False:
$ Wellness +=10
$ Cheat_Wellness = True
"You have entered the correct cheat for Wellness"
elif renpy.input == "Wellness Up" and Cheat_Wellness == True:
"Cheat was already entered before"
jump start
else:
"You did not enter a correct cheat phrase"
jump start
There are multiple ways of writing this, for example using "not Cheat_Wellness" instead of "Cheat_Wellness == False", and combining multiple conditions into one line using () brackets and "or" conditions to avoid copy and pasting lines with the same results... First get used to this code, then we can simplify it a bit more. (The indentation is a little messed up here, but notice there are two levels of indentation here)
define e = Character("Eileen")
default Cheat_Money = False
default Money = 0
default Wellness = 0
default Cheat_Wellness = False
# The game starts here.
label start:
e "Today we are testing out cheats"
e "So please enter a cheat"
menu:
"Cheat Input":
$ renpy.input("Enter a cheat")
if renpy.input == "Add Money" or renpy.input == "Wellness Up":
if renpy.input == "Add Money" and Cheat_Money == False:
$ Money +=100
$ Cheat_Money = True
"You have entered the correct cheat for Money"
elif renpy.input == "Add Money" and Cheat_Money == True:
"Cheat was already entered before"
jump start
elif renpy.input == "Wellness Up" and Cheat_Wellness == False:
$ Wellness +=10
$ Cheat_Wellness = True
"You have entered the correct cheat for Wellness"
elif renpy.input == "Wellness Up" and Cheat_Wellness == True:
"Cheat was already entered before"
jump start
else:
"You did not enter a correct cheat phrase"
jump start
e "So did you enter any cheats correctly?"
return
define e = Character("Eileen")
default Cheat_Money = False
default Money = 0
default Wellness = 0
default Cheat_Wellness = False
default Cheat_Password_input = ""
# The game starts here.
label start:
e "Today we are testing out cheats"
e "So please enter a cheat"
menu:
"Cheat Input":
$ Cheat_Password_input = renpy.input("Enter a cheat")
if Cheat_Password_input == "Add Money" or Cheat_Password == "Wellness Up":
if Cheat_Password_input == "Add Money" and Cheat_Money == False:
$ Money +=100
$ Cheat_Money = True
"You have entered the correct cheat for Money"
elif Cheat_Password_input == "Add Money" and Cheat_Money == True:
"Cheat was already entered before"
jump start
elif Cheat_Password_input == "Wellness Up" and Cheat_Wellness == False:
$ Wellness +=10
$ Cheat_Wellness = True
"You have entered the correct cheat for Wellness"
elif Cheat_Password_input == "Wellness Up" and Cheat_Wellness == True:
"Cheat was already entered before"
jump start
else:
"You did not enter a correct cheat phrase"
jump start
e "So did you enter any cheats correctly?"
menu:
"Yes":
pass
"No":
jump start
"Let me test it out more":
jump start
return