How do I move onto another route once chosen menu choice?

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.
Message
Author
Speeny
Newbie
Posts: 20
Joined: Fri Dec 26, 2014 6:52 am
Contact:

How do I move onto another route once chosen menu choice?

#1 Post by Speeny »

Here's my script so far. I'm using Jedit.

menu:
"Go for a stroll?":
jump goforastroll
"Stay here and admire the scenery.":
jump stayhere
label goforastroll:
b "I proceed to get up and go for a stroll..I wonder where it'll take me?"
return
^^this is the choice I want to progress with..so how do I go about doing so without choice 2 interfering?

label stayhere:
b "I can't help but feel somewhat disappointed..like I've missed a once in a lifetime encounter or something."
"Ben continues to stay positioned."
return

I am just wondering how I move onto another route (part of the game.) once I've chosen my choice from the choice menu?
I'm such a newbie at this, so please forgive my confusing wording. Lol
Go for a stroll is the right choice for the player. In other words, that's the choice I want to use in order to progress.

Hopefully I can get someone's feedback, and I hope it's not too confusing for ya'll.

Thanks..

User avatar
xavimat
Eileen-Class Veteran
Posts: 1461
Joined: Sat Feb 25, 2012 8:45 pm
Completed: Yeshua, Jesus Life, Cops&Robbers
Projects: Fear&Love
Organization: Pilgrim Creations
Github: xavi-mat
itch: pilgrimcreations
Location: Spain
Discord: xavimat
Contact:

Re: How do I move onto another route once chosen menu choice

#2 Post by xavimat »

First, maybe you have a problem with the indent. If you put your code between "[ code ]" tags, we'll see the indent:

Your code seems right. The game should jump to the label after the choice:

Code: Select all

label start:
    menu: 
        "Go for a stroll?":
            jump goforastroll
        "Stay here and admire the scenery.":
            jump stayhere

label goforastroll:
    b "I proceed to get up and go for a stroll..I wonder where it'll take me?" 
    return 

label stayhere:
    b "I can't help but feel somewhat disappointed..like I've missed a once in a lifetime encounter or something."
    "Ben continues to stay positioned."
    return 
But, about choices and branches, the more important is to organize your story, before coding.
Comunidad Ren'Py en español: ¡Únete a nuestro Discord!
Rhaier Kingdom A Ren'Py Multiplayer Adventure Visual Novel.
Cops&Robbers A two-player experiment | Fear&Love Why can't we say I love you?
Honest Critique (Avatar made with Chibi Maker by ~gen8)

Speeny
Newbie
Posts: 20
Joined: Fri Dec 26, 2014 6:52 am
Contact:

Re: How do I move onto another route once chosen menu choice

#3 Post by Speeny »

So, what's the best thing I could do to solve this?

Thanks :)

User avatar
xavimat
Eileen-Class Veteran
Posts: 1461
Joined: Sat Feb 25, 2012 8:45 pm
Completed: Yeshua, Jesus Life, Cops&Robbers
Projects: Fear&Love
Organization: Pilgrim Creations
Github: xavi-mat
itch: pilgrimcreations
Location: Spain
Discord: xavimat
Contact:

Re: How do I move onto another route once chosen menu choice

#4 Post by xavimat »

First, you need to organize your story in parts and branches and invent a label for every part.
As you do, the "jump" statement is used to jump to your labels.
If you have a bad route you can simple jump to a former label to let the player choose again.
As I said in my first post, organize your story. If you want, you can put here the flow of your game (or a part of it) and we can help you.
Comunidad Ren'Py en español: ¡Únete a nuestro Discord!
Rhaier Kingdom A Ren'Py Multiplayer Adventure Visual Novel.
Cops&Robbers A two-player experiment | Fear&Love Why can't we say I love you?
Honest Critique (Avatar made with Chibi Maker by ~gen8)

Speeny
Newbie
Posts: 20
Joined: Fri Dec 26, 2014 6:52 am
Contact:

Re: How do I move onto another route once chosen menu choice

#5 Post by Speeny »

So in order to transcend I use the "jump" label?

Speeny
Newbie
Posts: 20
Joined: Fri Dec 26, 2014 6:52 am
Contact:

Re: How do I move onto another route once chosen menu choice

#6 Post by Speeny »

I've jumped to my next scene..
but the second choice interferes.
How do I manage this from happening?

SundownKid
Lemma-Class Veteran
Posts: 2299
Joined: Mon Feb 06, 2012 9:50 pm
Completed: Icebound, Selenon Rising Ep. 1-2
Projects: Selenon Rising Ep. 3-4
Organization: Fastermind Games
Deviantart: sundownkid
Location: NYC
Contact:

Re: How do I move onto another route once chosen menu choice

#7 Post by SundownKid »

I don't get what you mean about interfering. You should probably post your current code for the scene (in code brackets so the indentation is preserved).

Speeny
Newbie
Posts: 20
Joined: Fri Dec 26, 2014 6:52 am
Contact:

Re: How do I move onto another route once chosen menu choice

#8 Post by Speeny »


menu:
"Go for a stroll?":
jump goforastroll
"Stay here and admire the scenery.":
jump stayhere
label goforastroll:
b "I proceed to get up and go for a slight walk around the area..I wonder where it'll take me?"
jump nextscene
label goforastroll:
scene nature with fade
play music "[TOP 100 OST] Visual Novel Melancholic_Mysterious Music #22 - Narcissu - Scarlet.mp3"
b "Aaah, the fresh air really opens up my senses."
b "I guess when people say go for a walk when your stressed, it really does help."
b "I usually take those things forgranted."
^^This segment ends, and then the second choice interferes whilst playing, resulting in the game ending.

This is choice 2: which interferes with choice 1..

label stayhere:
b "I can't help but feel somewhat dissapointed..like I've missed a once in a lifetime encounter or something."
"Ben continues to stay positioned."
return

Sorry if this is confusing..I'm extremely knew to this, and coding exactly isn't my forte...(YET)

Speeny
Newbie
Posts: 20
Joined: Fri Dec 26, 2014 6:52 am
Contact:

Re: How do I move onto another route once chosen menu choice

#9 Post by Speeny »

Finally figured out how to use code brackets on this site...!
There you go.

Code: Select all

  menu: 
        "Go for a stroll?":
            jump goforastroll
        "Stay here and admire the scenery.":
            jump stayhere
    label goforastroll:
            b "I proceed to get up and go for a slight walk around the area..I wonder where it'll take me?"
            jump nextscene
            label goforastroll: 
            scene nature with fade
            play music "[TOP 100 OST] Visual Novel Melancholic_Mysterious Music #22 - Narcissu - Scarlet.mp3"
    b "Aaah, the fresh air really opens up my senses."
    b "I guess when people say go for a walk when your stressed, it really does help."
    b "I usually take those things forgranted."
            
            
    label stayhere:
        b "I can't help but feel somewhat dissapointed..like I've missed a once in a lifetime encounter or something."
        "Ben continues to stay positioned."
        return 
        

mjshi
Regular
Posts: 179
Joined: Wed Mar 13, 2013 9:55 pm
Completed: MazeSite01, Ponderings of Time
Contact:

Re: How do I move onto another route once chosen menu choice

#10 Post by mjshi »

Ahh, indentations, how I loathe you. At least it's not as bad as C's constant pinky workout.

The labels should be outside of the menu, and need either a return function or jump to another label. Otherwise, Renpy reads your code like a book-- it goes through every single word, not something you want with choices and story branching.

Code: Select all

    menu: 
        "Go for a stroll?":
            jump goforastroll
        "Stay here and admire the scenery.":
            jump stayhere
    
label goforastroll:
    b "I proceed to get up and go for a slight walk around the area..I wonder where it'll take me?"
    # Where are you jumping to? Label nextscene doesn't exist xD (jump nextscene)
    # I don't really understand this part, you already defined the label, don't need to do it again (label goforastroll: )
    scene nature with fade
    play music "[TOP 100 OST] Visual Novel Melancholic_Mysterious Music #22 - Narcissu - Scarlet.mp3"
    b "Aaah, the fresh air really opens up my senses."
    b "I guess when people say go for a walk when your stressed, it really does help."
    b "I usually take those things forgranted."

    #either a "return" or a "jump continuestory" or something to continue the story. I'll go with return.
    return
            
            
label stayhere:
    b "I can't help but feel somewhat dissapointed..like I've missed a once in a lifetime encounter or something."
    "Ben continues to stay positioned."
    return 

label continuestory:
    #continue the story from where Ben decided to go for a stroll.
       
There's actually an easier way to do this without jumping all over the place.

Code: Select all

    menu:
        "Go for a stroll?":
            b "I proceed to get up and go for a slight walk around the area..I wonder where it'll take me?"
            # Again, these parts aren't needed.(jump nextscene
            # label goforastroll: )
            scene nature with fade
            play music "[TOP 100 OST] Visual Novel Melancholic_Mysterious Music #22 - Narcissu - Scarlet.mp3"
            b "Aaah, the fresh air really opens up my senses."
            b "I guess when people say go for a walk when your stressed, it really does help."
            b "I usually take those things forgranted."
            
        "Stay here and admire the scenery.":
            jump stayhere
            b "I can't help but feel somewhat dissapointed..like I've missed a once in a lifetime encounter or something."
            "Ben continues to stay positioned."
            return # Choosing to stay where he is will end the game for Ben ):

    # Continue the story here!
       
Hope this helped, good luck with your game!

Speeny
Newbie
Posts: 20
Joined: Fri Dec 26, 2014 6:52 am
Contact:

Re: How do I move onto another route once chosen menu choice

#11 Post by Speeny »

Hi, thanks for your reply.
So in regards to your response..
I have followed mostly everything you pointed out for me, the second choice still interferes..

Is there a possibility you could fix up the mistakes for me, and copy in the coding so I can just paste it in straight from here?

That would really help..this is such a pain in the ass..haha.

User avatar
xavimat
Eileen-Class Veteran
Posts: 1461
Joined: Sat Feb 25, 2012 8:45 pm
Completed: Yeshua, Jesus Life, Cops&Robbers
Projects: Fear&Love
Organization: Pilgrim Creations
Github: xavi-mat
itch: pilgrimcreations
Location: Spain
Discord: xavimat
Contact:

Re: How do I move onto another route once chosen menu choice

#12 Post by xavimat »

Speeny, again, check your indentations.
every label must be in the level 0 of indentation, that means: NO spaces before the word "label"; just stick to the left.
For the "menu" I prefer to put them in a label and use "jump" to another label.
To avoid your problem, don't let any label unfinished; that means, at the end of every label put always a "jump" to another label or a "return".
Your label "goforastroll" doesn't have anything to jump at or to return when it reaches its end, and, logically, it continues with the nex line of code (the label "stayhere" and its lines).
As mjshi has said, use another label to "continue_story" (or "chapter2", or whatever).

Code: Select all

label chapter25:
    menu:
        "Option 1":
            jump option1
        "Option 2":
            jump option2

label option1:
    "TExt of the option 1"
    jump chapter26  # YOU NEED THIS LINE, WITHOUT IT, THE PROGRAM WILL READ THE NEXT LINES

label option2:
    "Text of the option 2"
    "Bad ending"
    return # This returns to the Main Menu

label chapter26:
    "Here continues the story"
Comunidad Ren'Py en español: ¡Únete a nuestro Discord!
Rhaier Kingdom A Ren'Py Multiplayer Adventure Visual Novel.
Cops&Robbers A two-player experiment | Fear&Love Why can't we say I love you?
Honest Critique (Avatar made with Chibi Maker by ~gen8)

Speeny
Newbie
Posts: 20
Joined: Fri Dec 26, 2014 6:52 am
Contact:

Re: How do I move onto another route once chosen menu choice

#13 Post by Speeny »

Still confusing as ever for me, but I think I'll manage.
Thanks so much guys.

User avatar
Karl_C
Veteran
Posts: 232
Joined: Sun Mar 31, 2013 6:18 am
Contact:

Re: How do I move onto another route once chosen menu choice

#14 Post by Karl_C »

Take a look at 'Language Basics:Indentation and Blocks' in the Ren'py Docs:
  • A block is open at the start of a file.
  • A new block is started whenever a logical line is indented past the previous logical line.
  • All logical lines inside a block must have the same indentation.
  • A block ends when a logical line is encountered with less indentation than the lines in the block.
Indentation is very important to Ren'Py, and cause syntax or logical errors when it's incorrect.
Example:

Code: Select all

"This statement, and the if statement that follows, is part of a block."

if True:

    "But this statement is part of a new block."

    "This is also part of that new block."

"This is part of the first block, again."

mjshi
Regular
Posts: 179
Joined: Wed Mar 13, 2013 9:55 pm
Completed: MazeSite01, Ponderings of Time
Contact:

Re: How do I move onto another route once chosen menu choice

#15 Post by mjshi »

Here would be a working example. You can copy/paste this bit, but I do recommend reading the documentation and quickstart, also the links that Karl suggested.

Code: Select all

 # Please look through the code and read the lines with the # carefully
    menu:
        "Go for a stroll?":
            b "I proceed to get up and go for a slight walk around the area..I wonder where it'll take me?"
            scene nature with fade
            play music "[TOP 100 OST] Visual Novel Melancholic_Mysterious Music #22 - Narcissu - Scarlet.mp3"
            b "Aaah, the fresh air really opens up my senses."
            b "I guess when people say go for a walk when your stressed, it really does help."
            b "I usually take those things forgranted."
            
            # Because the second choice is a menu choice, it only occurs when the player chooses it.
        "Stay here and admire the scenery.":
            jump stayhere
            b "I can't help but feel somewhat dissapointed..like I've missed a once in a lifetime encounter or something."
            "Ben continues to stay positioned."
            return # Choosing to stay where he is will end the game for Ben ): Otherwise, you can add a jump to another label to continue the story.

    # Continue the story here! The story here will have Ben choosing to take a stroll. 
    "Story continued..."

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Milkymalk, wizard_jpg