How do I use the same dialogue in branching choices?

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
User avatar
DNAniel213
Regular
Posts: 33
Joined: Tue May 27, 2014 1:49 am
Completed: None.....yet...
Projects: "An Erudite's Heart"
Organization: S.E.R.N.
IRC Nick: DNAniel213
Contact:

How do I use the same dialogue in branching choices?

#1 Post by DNAniel213 »

Ummm. I'm new here. And, yeah that's no excuse.

So, how do I use the same dialogue in branching choices? :roll:
I mean, I want to branch off the story in two choices, then at some point the story diverges, but then they both jump to different passages.

Generally like:
Choices A and B.
The character goes to the supermarket, then to school, and returns home in choice A.
In B, the character takes a walk in the park, then to school, and then dies because of diarrhea or something like that.

So regardless of A or B, he'll have to go to school. And if I want to save script space(since keeping stuff organized seems better Manlier), I'll only code in what happens in school once.

Asceai
Eileen-Class Veteran
Posts: 1258
Joined: Fri Sep 21, 2007 7:13 am
Projects: a battle engine
Contact:

Re: How do I use the same dialogue in branching choices?

#2 Post by Asceai »

You want to set a variable, then branch on it later.

Check out this part of the Quickstart tutorial

User avatar
Marionette
Regular
Posts: 128
Joined: Thu Apr 21, 2011 12:04 pm
Completed: https://marionette.itch.io/
Projects: Get Meowt of Here
Deviantart: rexx9224
itch: marionette
Location: Ireland
Discord: Marionette#2995
Contact:

Re: How do I use the same dialogue in branching choices?

#3 Post by Marionette »

What he said or just have the common parts in separate labels that all return when they are complete

So you end up with something like

Route A:
jump supermarket
jump school
jump home

Route B:
jump park
jump school
jump grossDeath


This way you still have one duped line, but if everything is in labels its easy to see the path each route takes, and separating the parts of the story will help you keep things manly...er organised. :p

User avatar
DNAniel213
Regular
Posts: 33
Joined: Tue May 27, 2014 1:49 am
Completed: None.....yet...
Projects: "An Erudite's Heart"
Organization: S.E.R.N.
IRC Nick: DNAniel213
Contact:

Re: How do I use the same dialogue in branching choices?

#4 Post by DNAniel213 »

Lol, I've gone over quickstart like thrice already, but I didn't notice this gem. XD

Though, for a fact, I didn't know it's purpose either.
nor do I understand it already. =_=
Thanks!! :D
Give me 5 minutes to understand this......
=_= and 3 hours to implement this in the whole script...



And Marionette, x) I don't quite get what you replied, but... I dunno, could it work like..

menu:
"Route A"
jump supermarket
jump school
jump home


or something like that?
If it does, then nothing could be more convenient x)

Asceai
Eileen-Class Veteran
Posts: 1258
Joined: Fri Sep 21, 2007 7:13 am
Projects: a battle engine
Contact:

Re: How do I use the same dialogue in branching choices?

#5 Post by Asceai »

Marionette wrote:What he said or just have the common parts in separate labels that all return when they are complete

So you end up with something like

Route A:
jump supermarket
jump school
jump home

Route B:
jump park
jump school
jump grossDeath


This way you still have one duped line, but if everything is in labels its easy to see the path each route takes, and separating the parts of the story will help you keep things manly...er organised. :p
You want call, not jump.

User avatar
DNAniel213
Regular
Posts: 33
Joined: Tue May 27, 2014 1:49 am
Completed: None.....yet...
Projects: "An Erudite's Heart"
Organization: S.E.R.N.
IRC Nick: DNAniel213
Contact:

Re: How do I use the same dialogue in branching choices?

#6 Post by DNAniel213 »

If so, (I just read a couple of pages about the call statement) but I can't seem to put it to use.

will it jump directly to school then home if call statement is used?

and.. Thanks for the time!!

User avatar
sendo
Veteran
Posts: 290
Joined: Sun Sep 01, 2013 2:28 am
Completed: To Libertad, Diamond Rose, SC2VN, Sickness VN
Projects: eroges!
itch: sendo
Contact:

Re: How do I use the same dialogue in branching choices?

#7 Post by sendo »

DNAniel213 wrote:will it jump directly to school then home if call statement is used?
Yes.

The reason you don't want 'jump' with Marionette's example is that once you pick a route, the game will end once it hits the end of the first label you've jump to (ie supermarket for route A; park for route B). It won't continue to the school label unless you explicitly code it to supermarket/park labels. Jump does not return to where it was called (if that makes sense). So just replace jump with call and you're good to go.
Finished VNs:
Image Image

User avatar
Marionette
Regular
Posts: 128
Joined: Thu Apr 21, 2011 12:04 pm
Completed: https://marionette.itch.io/
Projects: Get Meowt of Here
Deviantart: rexx9224
itch: marionette
Location: Ireland
Discord: Marionette#2995
Contact:

Re: How do I use the same dialogue in branching choices?

#8 Post by Marionette »

DNAniel213 wrote:Lol, I've gone over quickstart like thrice already, but I didn't notice this gem. XD

Though, for a fact, I didn't know it's purpose either.
nor do I understand it already. =_=
Thanks!! :D
Give me 5 minutes to understand this......
=_= and 3 hours to implement this in the whole script...



And Marionette, x) I don't quite get what you replied, but... I dunno, could it work like..

menu:
"Route A"
jump supermarket
jump school
jump home


or something like that?
If it does, then nothing could be more convenient x)
Whoops, sorry for causing confusion. lol
I guess you 'jump' if you need to keep going forwards, ie new routes, and 'call' if you need to come back where you started. lol

So i guess to keep things extra simple, you can do something like

Code: Select all

menu:
  "choice 1"
    jump RouteA
  "choice 2"
    jump RouteB
  

label RouteA:
  call supermarket
  call school
  call home

etc.

And then even your menu is kept simple. :3

User avatar
DNAniel213
Regular
Posts: 33
Joined: Tue May 27, 2014 1:49 am
Completed: None.....yet...
Projects: "An Erudite's Heart"
Organization: S.E.R.N.
IRC Nick: DNAniel213
Contact:

Re: How do I use the same dialogue in branching choices?

#9 Post by DNAniel213 »

Thanks guys! Looks like finally registering here in lemmasoft was worth it! :D

When I understood python's basic if and then statements, it reduced my script length by about 10%

Added to learning the call statement(in which the wiki didn't elaborate much -_- ) x) reduced it by another 10% XD

but I'm more or less 1/4 way done. I've made a couple of 3-chapters worth novels(just words) back then, but just words wouldn't appeal to my type of stories. Then I found ren'py. Thanks!!!

A few more through, then my only problems would be the sprites. True, I can draw(basically), but I can't draw fast and I have about 9 characters (6 main characters) in my current novel.

I planned to make my first visual novel a short and safe one, but that day didn't bless me with a writer's block, and I kept typing the whole day. And here I am. Two weeks in, and I only have 3 complete sprites(Only one pose and clothing=_= Forgive me!)

I hope soon, I'll be able to par with you guys. Though I'll help with whatever way I can!
So if I may, I'll welcome myself to lemmasoft x) (foreveralone)

User avatar
Taleweaver
Writing Maniac
Posts: 3428
Joined: Tue Nov 11, 2003 8:51 am
Completed: Metropolitan Blues, The Loyal Kinsman, Daemonophilia, The Dreaming, The Thirteenth Year, Adrift, Bionic Heart 2, Secrets of the Wolf, The Photographer
Projects: The Pilgrim's Path, Elspeth's Garden, Secret Adventure Game!
Organization: Tall Tales Productions
Location: Germany
Contact:

Re: How do I use the same dialogue in branching choices?

#10 Post by Taleweaver »

Whoops, overlooked that one for a long time.

Ren'Py questions go into the Ren'Py questions forum. Thread moved.
Scriptwriter and producer of Metropolitan Blues
Creator of The Loyal Kinsman
Scriptwriter and director of Daemonophilia
Scriptwriter and director of The Dreaming
Scriptwriter of Zenith Chronicles
Scriptwriter and director of The Thirteenth Year
Scriptwriter and director of Romance is Dead
Scriptwriter and producer of Adrift
More about me in my blog
"Adrift - Like Ever17, but without the Deus Ex Machina" - HigurashiKira

User avatar
DNAniel213
Regular
Posts: 33
Joined: Tue May 27, 2014 1:49 am
Completed: None.....yet...
Projects: "An Erudite's Heart"
Organization: S.E.R.N.
IRC Nick: DNAniel213
Contact:

Re: How do I use the same dialogue in branching choices?

#11 Post by DNAniel213 »

oops. :oops: sorry x)
Reality, Bend
Synapse, Break
Banishment, This World!

Post Reply

Who is online

Users browsing this forum: Google [Bot]