starting out renpy, have som trouble with dialogue

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
wbertheau
Newbie
Posts: 3
Joined: Tue Aug 09, 2022 11:20 am
Contact:

starting out renpy, have som trouble with dialogue

#1 Post by wbertheau »

Hello,

As the subject said, i'm just started with renpy, i've learned alot trough youtube and google searches, but i can't seem to find out how to navigate rooms without the same dialogue "spawns" everytime.

For exempel:

You wake up, it says go to the kitchen, when you arrive at the kitchen for the first time, a dialogue pops, but when that ends i and i go out of the room and comeback, i want just the room.

Here is my code for the kitchen:

Code: Select all

label kitchen:
    scene bg_kitchen

    $ kitchenentered = "No"

    if kitchenentered == "No":
        show eileen happy at left with dissolve

        e "Hello [mcname]"

        hide eileen happy

        show eileen happy happy at right with dissolve

        m "Hello mom"
    
    call screen bg_kitchen

    screen bg_kitchen:
        add "bg_kitchen"
        imagebutton:
            focus_mask True
            idle "Kitchen/to_livingroom_idle.png"
            hover "kitchen/to_livingroom_hover.png"

            action Jump("upstairs")

User avatar
Alex
Lemma-Class Veteran
Posts: 3093
Joined: Fri Dec 11, 2009 5:25 pm
Contact:

Re: starting out renpy, have som trouble with dialogue

#2 Post by Alex »

wbertheau wrote: Tue Aug 09, 2022 11:25 am ...
Try to put all those '$ kitchenentered = "No"' outside of locations labels. For now every time game jumps to the kitchen label the 'kitchenentered' variable sets to 'No'.

Code: Select all

# declare all the necessary variables using
# default statement
default kitchenentered = 'No'

label start:
    "..."
    jump kitchen

label kitchen:
    scene bg_kitchen

    if kitchenentered == "No":
        # set new value for flag-variable
        $ kitchenentered = "Yes" # <--- !!!

        show eileen happy at left with dissolve

        e "Hello [mcname]"

        hide eileen happy

        show eileen happy happy at right with dissolve

        m "Hello mom"
    
    call screen bg_kitchen

https://www.renpy.org/doc/html/python.h ... -statement

wbertheau
Newbie
Posts: 3
Joined: Tue Aug 09, 2022 11:20 am
Contact:

Re: starting out renpy, have som trouble with dialogue

#3 Post by wbertheau »

I will try this asap, thank you.

User avatar
m_from_space
Miko-Class Veteran
Posts: 957
Joined: Sun Feb 21, 2021 3:36 am
Contact:

Re: starting out renpy, have som trouble with dialogue

#4 Post by m_from_space »

For simple "yes"/"no" flags you should learn about using booleans instead. Just use the values of True and False (case-sensitive!), it's much easier to test for them, too.

Code: Select all

default kitchenentered = False

label start:
    "..."
    jump kitchen

label kitchen:
    scene bg_kitchen

    if not kitchenentered:
        $ kitchenentered = True

    #...

wbertheau
Newbie
Posts: 3
Joined: Tue Aug 09, 2022 11:20 am
Contact:

Re: starting out renpy, have som trouble with dialogue

#5 Post by wbertheau »

Thank you so much, Alex.

And also you m_from_space.

Alex wrote: Tue Aug 09, 2022 12:50 pm
wbertheau wrote: Tue Aug 09, 2022 11:25 am ...
Try to put all those '$ kitchenentered = "No"' outside of locations labels. For now every time game jumps to the kitchen label the 'kitchenentered' variable sets to 'No'.

Code: Select all

# declare all the necessary variables using
# default statement
default kitchenentered = 'No'

label start:
    "..."
    jump kitchen

label kitchen:
    scene bg_kitchen

    if kitchenentered == "No":
        # set new value for flag-variable
        $ kitchenentered = "Yes" # <--- !!!

        show eileen happy at left with dissolve

        e "Hello [mcname]"

        hide eileen happy

        show eileen happy happy at right with dissolve

        m "Hello mom"
    
    call screen bg_kitchen

https://www.renpy.org/doc/html/python.h ... -statement

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Google [Bot], IrisColt, mold.FF, Semrush [Bot]