Getting Lines of Dialogue To Show Up Only At The Right Times

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
User avatar
Dollarluigi
Regular
Posts: 63
Joined: Mon Aug 15, 2016 10:06 pm
Completed: Winter Dream, School For The Friendless
Tumblr: Rehnchoro
Deviantart: Dollarluigi
Skype: Dollarluigi
Soundcloud: Dollarluigi
Location: Probably Earth
Contact:

Getting Lines of Dialogue To Show Up Only At The Right Times

#1 Post by Dollarluigi »

I've been using Ren'Py for a little bit for the my current (as well as first VN project), and every now and then I run into some issues. A few I've already cleared up. One I'd like to mention though, is I'm having a bit of difficulty having the game's script flow the way I want it. I'll explain as best as I can. Anyways, a lot of VNs I've played, will have text that the player will go trough no matter what choices they've made. What I really don't know at the moment is how to make that work.

For example, the player enters one route and then there are lines of dialogue they must go through no matter what choices they've made. Next, there's getting only certain lines of dialogue to show up at later points, but only when certain choices are made. So pretty much what I'm saying is that I can't figure out a way to get certain lines of dialogue to show up only when I want it to, as well as have certain lines still be there and not disrupt the flow of whatever route the player may be on. I hope this makes sense.

User avatar
NocturneLight
Regular
Posts: 163
Joined: Thu Jun 30, 2016 1:20 pm
Projects: Unsound Minds: The Clarevine Epoch
Organization: Reminiscent 64
Tumblr: Reminiscent64
itch: Reminiscent64
Location: Texas
Contact:

Re: Getting Lines of Dialogue To Show Up Only At The Right T

#2 Post by NocturneLight »

Dollarluigi wrote:I've been using Ren'Py for a little bit for the my current (as well as first VN project), and every now and then I run into some issues. A few I've already cleared up. One I'd like to mention though, is I'm having a bit of difficulty having the game's script flow the way I want it. I'll explain as best as I can. Anyways, a lot of VNs I've played, will have text that the player will go trough no matter what choices they've made. What I really don't know at the moment is how to make that work.

For example, the player enters one route and then there are lines of dialogue they must go through no matter what choices they've made. Next, there's getting only certain lines of dialogue to show up at later points, but only when certain choices are made. So pretty much what I'm saying is that I can't figure out a way to get certain lines of dialogue to show up only when I want it to, as well as have certain lines still be there and not disrupt the flow of whatever route the player may be on. I hope this makes sense.


If you want text to only appear at certain times, you'd do something like this:

Code: Select all

label start:
    ## Show a background. This uses a placeholder by default, but you can add a
    ## file (named either "bg room.png" or "bg room.jpg") to the images
    ## directory to show it.
    
    scene bg room

    ## This shows a character sprite. A placeholder is used, but you can replace
    ## it by adding a file named "eileen happy.png" to the images directory.
 
    show eileen happy

    ## These display lines of dialogue.

    "Hello, world."

    "You've created a new Ren'Py game."

    "Once you add a story, pictures, and music, you can release it to the world!"
    
    if Lock1Unlocked == True and Lock2Unlocked == True and Lock3Unlocked == True:
        e "You unlocked the super secret dialogue!"
        
    "Blah, blah, blah."
    ## This ends the game.
    return
As for the not disrupting the flow part, as far as I'm aware, that will have to depend on your writing skills.
The Old Guard is at His Limit. The time is near to usher in the New Guard.

The Great Horror is soon to be free.

Clarevine is the key.


"Unsound Minds: The Clarevine Epoch" is a yuri visual novel that shatters english visual novel norms and aims to blend Christianity and the Cthulhu Mythos to tell a deep and dark story that you'll enjoy. You can follow the Kickstarter here.

Stay sound and persist through the chaos,
NocturneLight

User avatar
Dollarluigi
Regular
Posts: 63
Joined: Mon Aug 15, 2016 10:06 pm
Completed: Winter Dream, School For The Friendless
Tumblr: Rehnchoro
Deviantart: Dollarluigi
Skype: Dollarluigi
Soundcloud: Dollarluigi
Location: Probably Earth
Contact:

Re: Getting Lines of Dialogue To Show Up Only At The Right T

#3 Post by Dollarluigi »

So, what would I have to do to make Lock1Unlocked true or false?

User avatar
NocturneLight
Regular
Posts: 163
Joined: Thu Jun 30, 2016 1:20 pm
Projects: Unsound Minds: The Clarevine Epoch
Organization: Reminiscent 64
Tumblr: Reminiscent64
itch: Reminiscent64
Location: Texas
Contact:

Re: Getting Lines of Dialogue To Show Up Only At The Right T

#4 Post by NocturneLight »

Dollarluigi wrote:So, what would I have to do to make Lock1Unlocked true or false?

That depends. I figure you want to get to the exclusive text through menu choices.


So I imagine you could do this:

Code: Select all

menu:
    "Choice1":
        $ ClareAffectionCount += 1
    "Choice2":
        $ HarunaAffectionCount += 1
    
    if ClareAffection == 5:
        $ Lock1Unlocked = True
    elif HarunaAffection == 5:
        $ Lock2Unlocked = True
The Old Guard is at His Limit. The time is near to usher in the New Guard.

The Great Horror is soon to be free.

Clarevine is the key.


"Unsound Minds: The Clarevine Epoch" is a yuri visual novel that shatters english visual novel norms and aims to blend Christianity and the Cthulhu Mythos to tell a deep and dark story that you'll enjoy. You can follow the Kickstarter here.

Stay sound and persist through the chaos,
NocturneLight

User avatar
Dollarluigi
Regular
Posts: 63
Joined: Mon Aug 15, 2016 10:06 pm
Completed: Winter Dream, School For The Friendless
Tumblr: Rehnchoro
Deviantart: Dollarluigi
Skype: Dollarluigi
Soundcloud: Dollarluigi
Location: Probably Earth
Contact:

Re: Getting Lines of Dialogue To Show Up Only At The Right T

#5 Post by Dollarluigi »

It's not working for me. I keep getting an error whenever I test the project.

User avatar
NocturneLight
Regular
Posts: 163
Joined: Thu Jun 30, 2016 1:20 pm
Projects: Unsound Minds: The Clarevine Epoch
Organization: Reminiscent 64
Tumblr: Reminiscent64
itch: Reminiscent64
Location: Texas
Contact:

Re: Getting Lines of Dialogue To Show Up Only At The Right T

#6 Post by NocturneLight »

Dollarluigi wrote:It's not working for me. I keep getting an error whenever I test the project.

What's the error? And are you defining the variables before using them?

For example:

Code: Select all

default ClareAffectionCount = 0
You have to define every single variable you use before using it. From Lock1Unlocked all the way to ClareAffectionCount.

Also, the error may or may not be because my if statement was supposed to be:

Code: Select all

if ClareAffectionCount == 5:
    $ Lock1Unlocked = True
elif HarunaAffectionCount == 5:
    $ Lock2Unlocked = True
and not:

Code: Select all

if ClareAffection == 5:
    $ Lock1Unlocked = True
elif HarunaAffection == 5:
    $ Lock2Unlocked = True
The Old Guard is at His Limit. The time is near to usher in the New Guard.

The Great Horror is soon to be free.

Clarevine is the key.


"Unsound Minds: The Clarevine Epoch" is a yuri visual novel that shatters english visual novel norms and aims to blend Christianity and the Cthulhu Mythos to tell a deep and dark story that you'll enjoy. You can follow the Kickstarter here.

Stay sound and persist through the chaos,
NocturneLight

User avatar
Dollarluigi
Regular
Posts: 63
Joined: Mon Aug 15, 2016 10:06 pm
Completed: Winter Dream, School For The Friendless
Tumblr: Rehnchoro
Deviantart: Dollarluigi
Skype: Dollarluigi
Soundcloud: Dollarluigi
Location: Probably Earth
Contact:

Re: Getting Lines of Dialogue To Show Up Only At The Right T

#7 Post by Dollarluigi »

The error is "if statement expects a non-empty block."

User avatar
NocturneLight
Regular
Posts: 163
Joined: Thu Jun 30, 2016 1:20 pm
Projects: Unsound Minds: The Clarevine Epoch
Organization: Reminiscent 64
Tumblr: Reminiscent64
itch: Reminiscent64
Location: Texas
Contact:

Re: Getting Lines of Dialogue To Show Up Only At The Right T

#8 Post by NocturneLight »

Dollarluigi wrote:The error is "if statement expects a non-empty block."

The tabs are probably off then.

Under the if statement, the line has to be 4 spaces ahead.


It'll look like this:

Code: Select all

if ClareAffectionCount == 1:
    $ Lock1Unlocked = True
The Old Guard is at His Limit. The time is near to usher in the New Guard.

The Great Horror is soon to be free.

Clarevine is the key.


"Unsound Minds: The Clarevine Epoch" is a yuri visual novel that shatters english visual novel norms and aims to blend Christianity and the Cthulhu Mythos to tell a deep and dark story that you'll enjoy. You can follow the Kickstarter here.

Stay sound and persist through the chaos,
NocturneLight

User avatar
Dollarluigi
Regular
Posts: 63
Joined: Mon Aug 15, 2016 10:06 pm
Completed: Winter Dream, School For The Friendless
Tumblr: Rehnchoro
Deviantart: Dollarluigi
Skype: Dollarluigi
Soundcloud: Dollarluigi
Location: Probably Earth
Contact:

Re: Getting Lines of Dialogue To Show Up Only At The Right T

#9 Post by Dollarluigi »

Okay, I've got it to direct to that text, but I can't seem to get it to refrain from displaying that text when the opposite choice is chosen.
Suffering a rare condition is one of the worst things you could ever experience because no one understands a thing.

YouTube Twitter Tumblr Reddit deviantArt

User avatar
trooper6
Lemma-Class Veteran
Posts: 3712
Joined: Sat Jul 09, 2011 10:33 pm
Projects: A Close Shave
Location: Medford, MA
Contact:

Re: Getting Lines of Dialogue To Show Up Only At The Right T

#10 Post by trooper6 »

Show your code.

In between the [ code] and [ /code] tags...without the extra space. So we can see what you are doing.
A Close Shave:
*Last Thing Done (Aug 17): Finished coding emotions and camera for 4/10 main labels.
*Currently Doing: Coding of emotions and camera for the labels--On 5/10
*First Next thing to do: Code in all CG and special animation stuff
*Next Next thing to do: Set up film animation
*Other Thing to Do: Do SFX and Score (maybe think about eye blinks?)
Check out My Clock Cookbook Recipe: http://lemmasoft.renai.us/forums/viewto ... 51&t=21978

User avatar
NocturneLight
Regular
Posts: 163
Joined: Thu Jun 30, 2016 1:20 pm
Projects: Unsound Minds: The Clarevine Epoch
Organization: Reminiscent 64
Tumblr: Reminiscent64
itch: Reminiscent64
Location: Texas
Contact:

Re: Getting Lines of Dialogue To Show Up Only At The Right T

#11 Post by NocturneLight »

Dollarluigi wrote:Okay, I've got it to direct to that text, but I can't seem to get it to refrain from displaying that text when the opposite choice is chosen.

By "that" text you mean:

Code: Select all

if Lock1Unlocked == True and Lock2Unlocked == True and Lock3Unlocked == True:
        e "You unlocked the super secret dialogue!"

Correct?

If it keeps showing "You unlocked the super secret dialogue!", then perhaps you defined all three locks as True instead of False?

And yes. I want to see the code too.
The Old Guard is at His Limit. The time is near to usher in the New Guard.

The Great Horror is soon to be free.

Clarevine is the key.


"Unsound Minds: The Clarevine Epoch" is a yuri visual novel that shatters english visual novel norms and aims to blend Christianity and the Cthulhu Mythos to tell a deep and dark story that you'll enjoy. You can follow the Kickstarter here.

Stay sound and persist through the chaos,
NocturneLight

User avatar
Dollarluigi
Regular
Posts: 63
Joined: Mon Aug 15, 2016 10:06 pm
Completed: Winter Dream, School For The Friendless
Tumblr: Rehnchoro
Deviantart: Dollarluigi
Skype: Dollarluigi
Soundcloud: Dollarluigi
Location: Probably Earth
Contact:

Re: Getting Lines of Dialogue To Show Up Only At The Right T

#12 Post by Dollarluigi »

I've actually only set two variables so far: Lock1Unlocked and FCount

Anyways, here's the code. The dialogue's been changed because I'm usually very secretive about my work.

Code: Select all

menu:

        c "Dialogue"

        "Option 1":
            $ FCount += 1
            
            jump choice1

        "Option 2":

            jump choice2

label choice1:

     "Dialogue"
     c "Dialogue"

     jump fstart

label choice2:

    c "Dialogue"
    "Dialogue"
    "Dialogue."

    jump choice_end
    
label choice_end:         

    "Dialogue"
    "Dialogue"

    if FCount = 0:
        
        $ Lock1Unlocked = False
        
        jump notonfroute
    
    if FCount == 1:
        
        $ Lock1Unlocked = True
    
    c "Dialogue"
    "Dialogue"
    f "Dialogue"
    c "Dialogue"
    f "Dialogue"
    c "Dialogue"
    c "Dialogue"
    f "Dialogue"
    c "Dialogue"
    f "Dialogue"
    c "Dialogue"
    c "Dialogue"
    c "Dialogue"
    f "Dialogue"
    c "Dialogue"
    f "Dialogue"
    c "Dialogue"
    c "Dialogue"
    "Dialogue"
    "Dialogue"
    
jump start

label notonfroute:

    c "Dialogue"
Suffering a rare condition is one of the worst things you could ever experience because no one understands a thing.

YouTube Twitter Tumblr Reddit deviantArt

User avatar
NocturneLight
Regular
Posts: 163
Joined: Thu Jun 30, 2016 1:20 pm
Projects: Unsound Minds: The Clarevine Epoch
Organization: Reminiscent 64
Tumblr: Reminiscent64
itch: Reminiscent64
Location: Texas
Contact:

Re: Getting Lines of Dialogue To Show Up Only At The Right T

#13 Post by NocturneLight »

I can understand being secretive. We wouldn't want our next Grand Epic of a story to get leaked to the world before it's finished.

Right off the bat, I can tell you:

Code: Select all

if FCount = 0:
        
        $ Lock1Unlocked = False
        
        jump notonfroute
should be:

Code: Select all

if FCount == 0:
        
        $ Lock1Unlocked = False
        
        jump notonfroute
Do you still get an error after that?
The Old Guard is at His Limit. The time is near to usher in the New Guard.

The Great Horror is soon to be free.

Clarevine is the key.


"Unsound Minds: The Clarevine Epoch" is a yuri visual novel that shatters english visual novel norms and aims to blend Christianity and the Cthulhu Mythos to tell a deep and dark story that you'll enjoy. You can follow the Kickstarter here.

Stay sound and persist through the chaos,
NocturneLight

User avatar
trooper6
Lemma-Class Veteran
Posts: 3712
Joined: Sat Jul 09, 2011 10:33 pm
Projects: A Close Shave
Location: Medford, MA
Contact:

Re: Getting Lines of Dialogue To Show Up Only At The Right T

#14 Post by trooper6 »

You indentation is not correct. You did not define your variables at the start of the game. You has a mistake in one of your if statements. It should look more like this:

Code: Select all

# Declare characters used by this game.
define e = Character('Eileen', color="#c8ffc8")

default FCount = 0

# The game starts here.
label start:
    c "Dialogue"

    menu:
        "Option 1":
            $ FCount += 1
            jump choice1
        "Option 2":
            jump choice2

label choice1:
    "Dialogue"
    c "Dialogue"
    jump fstart

label choice2:
    c "Dialogue"
    "Dialogue"
    "Dialogue."
    jump choice_end

label choice_end: 
    "Dialogue"
    "Dialogue"

    if FCount == 0: #Note this is a douple == not a single =
        $ Lock1Unlocked = False
        jump notonfroute
    else FCount == 1:
        $ Lock1Unlocked = True

    c "Dialogue"
    "Dialogue"
    f "Dialogue"
    c "Dialogue"
    f "Dialogue"
    c "Dialogue"
    c "Dialogue"
    f "Dialogue"
    c "Dialogue"
    f "Dialogue"
    c "Dialogue"
    c "Dialogue"
    c "Dialogue"
    f "Dialogue"
    c "Dialogue"
    f "Dialogue"
    c "Dialogue"
    c "Dialogue"
    "Dialogue"
    "Dialogue"

    jump start

label notonfroute:

    c "Dialogue"
But I still don't think this code it optimal. However, I can't really guess how to make it better without some sort of better idea what is going on here. You can make fake dialogue so that we can see what is supposed to be happening in terms of flow.
A Close Shave:
*Last Thing Done (Aug 17): Finished coding emotions and camera for 4/10 main labels.
*Currently Doing: Coding of emotions and camera for the labels--On 5/10
*First Next thing to do: Code in all CG and special animation stuff
*Next Next thing to do: Set up film animation
*Other Thing to Do: Do SFX and Score (maybe think about eye blinks?)
Check out My Clock Cookbook Recipe: http://lemmasoft.renai.us/forums/viewto ... 51&t=21978

User avatar
Dollarluigi
Regular
Posts: 63
Joined: Mon Aug 15, 2016 10:06 pm
Completed: Winter Dream, School For The Friendless
Tumblr: Rehnchoro
Deviantart: Dollarluigi
Skype: Dollarluigi
Soundcloud: Dollarluigi
Location: Probably Earth
Contact:

Re: Getting Lines of Dialogue To Show Up Only At The Right T

#15 Post by Dollarluigi »

Thanks. It works now.
Suffering a rare condition is one of the worst things you could ever experience because no one understands a thing.

YouTube Twitter Tumblr Reddit deviantArt

Post Reply

Who is online

Users browsing this forum: Google [Bot]