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.
Okay so I'm basically a newbie but I couldn't find the answer anywhere so I decided to ask.
Basically at this point I'm very close to finish my game however I decided it would be a fun idea to add easter eggs in the character naming screen.
If you added a normal name like Peter it would play the game normally. But if you named your character something like 'Pinneapple' it would jump you to a hidden scene.
This is what it looks like right now. But I can't get it to work at all.
python:
name = renpy. input ("Its in your resume, but he is asking so... tell him again?")
name = name.strip() or "Waz"
if name.strip("Shark") or name.strip("Penguin"):
jump Oswald_easter
elif jump you_have_been_named
While the normal naming worked fine I can't get the last bit to work and it gives me the 'invalix syntax' error unless removed.
Last edited by pi3shark on Mon Apr 23, 2018 1:08 pm, edited 1 time in total.
Your syntax and identation are slightly incorrect. First, what you probably want here is to use else statement instead of elif, wich is for checking a different condition, maybe another name, but you're already doing that in the if line with the or statement. So it could be something like this:
python:
name = renpy.input("Its in your resume, but he is asking so... tell him again?")
name = name.strip() or "Waz"
if name == "Shark" or name == "Penguin":
jump Oswald_easter
else:
jump you_have_been_named
It might be better to declare the variable using default statement, and use $ interpolation in the script to set the variable instead of using python statement. Also, just in case you should put the easter egg label in a separate file from the script file, or at the very end. Here's what I mean:
default name = "Waz" # We declare the variable here.
label start:
scene black
$ name = renpy.input("Its in your resume, but he is asking so... tell him again?") #The user inputs the name
$ name = name.strip()
if name == "Shark" or name == "Penguin": # We check if whatever the input is Shark or Penghin
jump Oswald_easter #We jump to Oswald easter label if it is
else:
jump you_have_been_named # If not, we jump to the other label
label you_have_been_named:
"The normal game"
return
label Oswald_easter:
"Easter Egg!"
return
DannX wrote: ↑Mon Apr 23, 2018 12:56 pm
It might be better to declare the variable using default statement, and use $ interpolation in the script to set the variable instead of using python statement. Also, just in case you should put the easter egg label in a separate file from the script file, or at the very end. Here's what I mean:
default name = "Waz" # We declare the variable here.
label start:
scene black
$ name = renpy.input("Its in your resume, but he is asking so... tell him again?") #The user inputs the name
$ name = name.strip()
if name == "Shark" or name == "Penguin": # We check if whatever the input is Shark or Penghin
jump Oswald_easter #We jump to Oswald easter label if it is
else:
jump you_have_been_named # If not, we jump to the other label
label you_have_been_named:
"The normal game"
return
label Oswald_easter:
"Easter Egg!"
return