Help on making different input names jump to different scenes [SOLVED]

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.
Post Reply
Message
Author
pi3shark
Newbie
Posts: 9
Joined: Mon Apr 23, 2018 12:04 pm
Completed: Get Hired!, Testisim
Projects: Testisim Vol.2
Tumblr: hermannco
Deviantart: pi3shark
Contact:

Help on making different input names jump to different scenes [SOLVED]

#1 Post by pi3shark »

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.

Code: Select 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.

DannX
Regular
Posts: 99
Joined: Mon Mar 12, 2018 11:15 am
Contact:

Re: Help on making different input names jump to different scenes

#2 Post by DannX »

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:

Code: Select all

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

pi3shark
Newbie
Posts: 9
Joined: Mon Apr 23, 2018 12:04 pm
Completed: Get Hired!, Testisim
Projects: Testisim Vol.2
Tumblr: hermannco
Deviantart: pi3shark
Contact:

Re: Help on making different input names jump to different scenes

#3 Post by pi3shark »

I tried to do this and the problem is that now it only jumps directly to the easter egg scene regardless of what name I put.

DannX
Regular
Posts: 99
Joined: Mon Mar 12, 2018 11:15 am
Contact:

Re: Help on making different input names jump to different scenes

#4 Post by DannX »

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:

Code: Select all

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

pi3shark
Newbie
Posts: 9
Joined: Mon Apr 23, 2018 12:04 pm
Completed: Get Hired!, Testisim
Projects: Testisim Vol.2
Tumblr: hermannco
Deviantart: pi3shark
Contact:

Re: Help on making different input names jump to different scenes

#5 Post by pi3shark »

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:

Code: Select all

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
OH THAT WORKED WONDERS!
Thank you very much!

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot]